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.
I love the programming 101. Thank you!
There is not any hint or clue indicates that the n will greater than 3e6. I have to use my imagination to find out what time(or space) complexity is really required for this problem.
If it can't be described as confusing, I think the only word can be used here is - ridiculous.
My code can deal with game(500000) in 5s. It's not that slow for an O(n) implementation of Python.
I know may be there is a way (or many ways) to optimize. But it's not the problem.
I want know the RANGE OF DATA!
If n is 10 or less, an O(n^2) solution is fine. If n is about 10000, an O(n) solution is enough. If n is greater than 1e7, an O(1) solution is necessary.
I'm fully aware the rules of solving algorithm problems. I'm experienced.
But I hate to rewrite to code again and again, because the the f* website hides the range of data.
At the very beginning, I thought the largest n is 8!
I'm really really depressed by what the problem I'm suffering here.
I implemented an O(n) solution with Python, but I got TLE. I really don't know why my code runs so slow, and of course, I have no idea about the upper bound of the input n.
I'm depressed, by this problem, and by Codewars. I don't have enough information for solving the problem. I don't think it's a good idea to hide (or just ignore) the essential information for problem solving.
Codewars is not a coder friendly online judge system. Let aside the confusing output format. (gosh)
I'm confounded.
I quit.