educative.io

Code not editable

not able to edit my code in Valid Palindrome of Grokking Coding Interview Patterns in JavaScript course? Please fix it asap.


Course: Grokking Coding Interview Patterns in JavaScript - Learn Interactively
Lesson: Valid Palindrome - Grokking Coding Interview Patterns in JavaScript

Hi Arpan,

Thanks for reaching out.

I tested the coding widget in the Try it yourself section and found that everything worked as expected.

If you could provide some more detail on your experience, we might be able to support you better.

code is editable 2

It is editable now but got another issue.

In Valid Palindrome II lesson of Grokking Coding Interview Patterns in JavaScript, I have pasted this code into the editor

export function isPalindrome(s) {
if(s.length === 1) {return true;}
let left = 0, right = s.length - 1;
let count = 0;

while (left < right && count <=1) {
    if(s[left] !== s[right]){
        if(s[left] === s[right-1]) {count++; right--;}
        else if(s[left+1] === s[right]) {count++; left++;}
        else {return false;}
    }
    left++;
    right--;
}
if(count <= 1) {return true;}

}.

However, it keeps giving me the error “Error encountered during parsing results”. Due to this error, test cases are not running.

Can you please let me know if there is a mistake in my code or if there is an issue with the code editor?


Course: Grokking Coding Interview Patterns in JavaScript - Learn Interactively
Lesson: Valid Palindrome II - Grokking Coding Interview Patterns in JavaScript

Hi Arpan,

If you look carefully at your code, there are three returns, and each is within a logical branch (in an if branch, in an else within the while block and lastly in an if branch).
There is however a path through the code where nothing is returned by the function: if the value of count after the while loop is greater than 1, the function ends without returning anything.

Thank you for pointing out this issue – we will look into improving the error message returned by the code editor.

Hope this helps!

1 Like