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 comment is hidden because it contains spoiler information about the solution
.split
return strings and that coerces them into numbers.Granted, that's a weird way to do it, but it's not pointless. At all. If you try to remove that part, it wouldn't work.
This solution is bad. It is not about complexity, it is about memory usage. There is O(n) additional memory.
Your solution loops through twice as well... What's the point of nitpicking time complexity when you are doing the same thing? Your
else
also doesn't need tofind
anything. You already have it inevenValues[0]
. Even with that optimization, your worst case is still n^3 for an array length of 3 and n^2 for other cases.At least come up with a performant solution without unnecessary things before complaining that other people's solutions are "unnecessary and not performant".