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.
lul
yes, absolutely true! Although I explained this point in a comment before. But then I didn’t know how to use formatting, and it was very difficult to understand the code that I wrote in the comment.
It's a pursuit of brevity.
Probably a bit late, but -48 can be replaced by -'0' for a better understanding
It's compact but I can not agree that this is best practice. I would rather have long readable code than short code that I have to pause on...
This comment is hidden because it contains spoiler information about the solution
This is N Log N time complexity. This task can be completed in N.
Danke you for the clarification
We're playing the code golf (https://en.wikipedia.org/wiki/Code_golf) game, tl;dr write a solution with the minimal number of characters. Yes, in real, production code, you'd use
const
orlet
(var
is still valid, but most modern code useslet
unlessvar
is absolutely necessary, since it has slightly different behavior https://stackoverflow.com/a/11444416/12101554), but this is still valid JavaScript.Use const, let or var!!!
flipao
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Yes, thanks, really very stupid mistake.))))
The number finds itself, as in a mirror
Solution gives wrong results for input
[2,3,1], 4
.You also have O(n), if you want to find solutions with the best result, then there are other sites for this, where this is emphasized. Or you can post 2 solutions. One is short, the other is optimal.
For all arrays of type [0,0,0,1] you have the same result.
I don't think you'll get extra points for fast execution here.
Loading more items...