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.
Remove it. There're no final tests with
n
this big. If you indeed want to check your solution on this input (it's correct, I suppose), change then
type tolong
.Yea, I get that but I have no idea how to proceed. That's Why I'm asking for help. Out of ideas unless someone can give me a hint in the right direction. thanks.
string[] names = new string[] { "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" };
Line.WhoIsNext(names, 1) == "Sheldon"
Line.WhoIsNext(names, 52) == "Penny"
Line.WhoIsNext(names, 7230702951) == "Leonard"
this is some conditions of the task.
and when I try to solve this task in my IDE, 7 230 702 951 - "the number is too large for int"
Reducing the time complexity is the whole idea of the kata
-_-
It should be at most
O(log(n))
to pass the tests.This comment is hidden because it contains spoiler information about the solution
I couldn't find such test in Java...
It seems there's no problem with
n
being so big even though it's stored asint
.In descritption we see:
"The input data consist of an array which contains five names, and single integer n.
(1 ≤ n ≤ 1 000 000 000)."
But in output/examples we must receive "Leonard" for n == 7 230 702 951.
How can it be possible? It is more than int.