educative.io

Educative

Input formatting seems wrong for example

Test cases do not seem to pass the input as string, though the function expects string, For example, findLength(cbbebi, 3) sould be findLength(“cbbebi”, 3). As a consequence the code as texted on local Clion works for string input but not in the educative test setup.
Please let me know the workout/help.


Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/5698217712812032

Hello @neha_dubey

Test cases are passing the input as a string. To confirm this, I used the following code within the function:

const longest_substring_with_k_distinct = function(str, k) {
  console.log(typeof str);
};

This prints string onto the console for every test case.

Hope this helps!