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.
simply cuz 1+1=2
but 97+97!=98
why 20? maybe Math.log(num)+1 ?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
findAny() better
findAny() better findFirst()
so slow
bad idea don't do it
your sorting solution has a complexity of O (LogN) when this problem can be solved in O (2N)
see my solution, it passes the tests but does not work correctly with negative values
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Not sure why you claim this. The Java reference solution correctly handles this test case. Furthermore, the random tests produce a mix of positive and negative numbers; sometimes they are all negative, and there is no issue with the code.
this O(logN)
its kata can be solved O(N)
Insufficient coverage of tests in the java language. If we take all the numbers negative, then the output does not correspond to the condition of the problem.
sum(new int[]{-1, -50, -100})
assert -50
Loading more items...