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.
The time complexity of the algorithm in this solution is O(n² log n).
This comment is hidden because it contains spoiler information about the solution
Thanks for pointing that out, I have a lot to learn.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Correct operation of the function in this solution is not guaranteed.
Input: 1125899940397056 | Expected: 1125899906842624 | Output: 1125899973951489
Input: 4900000070000000 | Expected: 4900000000000000 | Output: 4900000140000001
Input: 9007199041343960 | Expected: 9007198946437696 | Output: 9007199136250225
The total number of such cases (for safe integers) is over 72 million.
This is perhaps the first such integer: 1125899940397056. For this input, the answer should be 1125899906842624, but it gives 1125899973951489.
And the total number of such safe integers is tens of millions.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Input: 117649 | Harmonic mean: 6.000007285602921 | Expected: false | Output: true
Input: 1953125 | Harmonic mean: 8.000000819200084 | Expected: false | Output: true
Input: 4782969 | Harmonic mean: 10.000000696917242 | Expected: false | Output: true
Input: 8388608 | Harmonic mean: 12.00000071525578 | Expected: false | Output: true
Input: 1953125 | Harmonic mean: 8.000000819200084 | Expected: false | Output: true
Input: 4782969 | Harmonic mean: 10.000000696917242 | Expected: false | Output: true
Input: 8388608 | Harmonic mean: 12.00000071525578 | Expected: false | Output: true
Input: 30240 | Harmonic mean: 24 | Expected: true | Output: false
Input: 1421280 | Harmonic mean: 47 | Expected: true | Output: false
Input: 1539720 | Harmonic mean: 47 | Expected: true | Output: false
Input: 625 | Harmonic mean: 4.001280409731113 | Expected: false | Output: true
Input: 4658 | Harmonic mean: 5.000536768652711 | Expected: false | Output: true
Input: 97903 | Harmonic mean: 7.000071500071501 | Expected: false | Output: true
Input: 117649 | Harmonic mean: 6.000007285602921 | Expected: false | Output: true
Input: 30240 | Harmonic mean: 24 | Expected: true | Output: false
Input: 1421280 | Harmonic mean: 47 | Expected: true | Output: false
Input: 1539720 | Harmonic mean: 47 | Expected: true | Output: false
Loading more items...