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
This comment is hidden because it contains spoiler information about the solution
Short, but not very efficient - it first sorts the full string, even for strings like 'ba....'
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Nice, but it could be shorter - you could convert the string from start to lowercase, and handle in map() only the case for lowercase (as initial case doesn't matter, anyway, in the end). And converting the even positioned chars in uppercase at the end seems a stretch done like this (instead of using Character.toLowerCase())
This comment is hidden because it contains spoiler information about the solution
Nice, first recursive solution I see here (not super efficient, but nice). As a note, you could have skipped storing inhab as a separate variable and having if logic over it, at the cost of 1 more iteration :) - check my solution.. (I wrote it for fun in Scala then translated it in Java)
This comment is hidden because it contains spoiler information about the solution
nice :).. using that toUpperCase at the end to avoid another 2 replacements...
This comment is hidden because it contains spoiler information about the solution
I see this is voted as Best Practice. Yes, is clear and simple, but not very efficient - that final multiplication for the check is actually unnecessary, it would be enough to check that the square root s is a whole (int) number, would be faster at runtime.
Not so efficient to compute .sqrt(n) twice (instead of saving it in a variable first)