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
Why O(n) doesn't fast enough?
For most katas, may be. But there are katas with certain demands to the code itself. Maybe I just overthought it. Anyway - there is a mistake in the placeholder.
UPD: I managed to put the solution between 'return string' and ';', so it is possible to solve without changing the placeholder, thus the task is correct, but a bit tricky.
This:
class Kata {
static String alternateCase(final String string) {
return string;
}
}
UPD: However, I've made some research and learned something from this, so it's not in vain.
Java
Given is the final String and the same String to return. So, accoring to the task, we have to mutate given string.
I didn't find the way how to do that and looked at the solutions. All of them return another Strings. And they are considered done!
It's so frustrating.
Question to the author: How to mutate final String in Java if Strings are initially immutable?
I forgot to delete the row reverseRoute[0] = "Begin " + arr[arr.length-1].split(" ", 2)[1]; so I initialized reverseRoute[0] twice. I'm not sure whether there is an option to edit solution or only add an alternative.
This comment is hidden because it contains spoiler information about the solution
I havent troubles - my solution accidentally passed tests.
ty for "abs" remark. Squaring gives positive result anyway.
UPD:
my result 9.055385138137417
in example 9.05538513814
my result 10.295630140987
in example 10.295630141
I should have been more careful. Sorry.
Math.hypot(Math.abs(x1-x2), Math.abs(y1-y2)) returns slightly different values from explanation values. How the author calculated distances? And which method is right?
This comment is hidden because it contains spoiler information about the solution