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.
definitely the cleanest version of these solutions, although I feel people will vote for something more cheeky..
Not only this is hard to read, but the performance is not very good.
It isn't one loop. It filters (and sorts) twice. EDIT: nevermind, I see that you're asking how one might do it in one loop.
Oki. I thought my solution has big problems with performance. But how can u do it using one loop?
No idea, just copied and pasted it and it still works for me. Why wouldn't it work?
This solution does not pass the test. Has something changed or been updated?
Thanks for pointing that out, I have a lot to learn.
No need to overcomplicate the task. U r given a straightforward task which presumes an array of only positive integers
Just when I think I did something something smart..
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.
There are a lot of loops in this solution, but it's clever overall. I believe you can simplify it by returning:
instead of:
lol why i didnt think this way
first i filtered the array in map function thn reduced it
Maybe it shoud be done other way around? Check for valid numbers insead of checking if its false?
geniusly...
work smart not hard
Loading more items...