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.
This kata is 3 kyu for a reason.
Your code needs to be optimised. The fact you can't do that is not a fault of the kata.
This comment is hidden because it contains spoiler information about the solution
Yes you are right i made a mistake in understanding the problem. Thank you for replying
Unlikely.
Please read the docs on how to debug your code, and how to raise
Issue
s after you've made very sure it's not actually your code that has the problem.Closing now, please reraise after you've read that, in a more useful manner.
I did what it asked me but it isn't accepting my code due to faulty case lol
Yea you are right thank you bro.
you can stare at your code and think about what it means, you can use print statements to see what that value is at any point, but it's up to you, and you should be able to figure out how you have given your variable its value
Sorry bro but this is not helping if you can explain how is the value becoming less than 0 i will appreciate it otherwise thank you for your assistance
it's less than zero
This comment is hidden because it contains spoiler information about the solution
You are passing a negative value into
charAt()
in this line of code....so it is going to crash for sure if you keep doing that
This comment is hidden because it contains spoiler information about the solution
The problem is you're trying access a string by index, but using a negative index, which is not possible.
When you make such a change, the error message you get changes because a different test is being affected.
(if length is 5, then length - 1 == 4 ... index within bounds)
(if length is 0, then length - 1 == -1 ... index out of bounds)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution