Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
As you iterate through your list (
text
here),you are conditionally removing elements from the list.
This will result in unpredictable behaviour.
If removal is necessary, iterate over a copy of the list
or use techniques such as iterating backwards
to avoid index shifting issues.
i
is case-sensitive andn
is lower case.That could be your problem.
What language is this?
Thank you!
Thanks much
Your code is counting number of unique elements in the input. For the case of input
"aaabbb"
, your function computes an uniqueArr to be of length 0. And returnstrue
, while the expected answer isfalse
.Instead, you must determine whether ONLY one element occcurs ODD number of times.
"aaabbb"
, your logic would compute 2 (botha
andb
occur odd number of times). In this case, since it is more than one, your function should return false."aaabbbb"
, your logic would compute 1 (onlya
occurs odd number of times). And therefore function should return true. (bbaaabb
orabbabba
would be valid palindromes).I hope this helps!
Thank you very much!
Glad you liked it!
This comment is hidden because it contains spoiler information about the solution
Node v18.x is what it is set to. What do you want to change it to?
When I try changing to assert.deepEqual, I get the following error:
The problem (quite elementary) is the first line of code. Are you missing an assignment?
Braces are optional (and therefore not used here) when there is only one statement inside the loop block. This implies that the return statement executes only after the while loop has completed. Hope this helps.
I would love to fix this.
But the scars of some very rude snobs here on CodeWars discourage me from trying anything new.
Thanks much!
This comment is hidden because it contains spoiler information about the solution
Loading more items...