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.
Very nice. my take on this sorted the odds the same. But I really dig the way you handled the data thereafter.
I think shift is too expensive to use, better use pop
Так эта операция O(1), так что не вижу в этом ничего плохого + они считаются в разных контекстах, автор конечно мог быть сохранить результаты вычислений в hash map, но в данном случае это стоило бы гораздо дороже, чем просто повторно произвести вычисление
То, что меня напрягает в этом решении — это то, что оно O(n^2) из-за того, что внутри
.map
используется.shift
, хотя задача спокойно решается за O(n)🔎
Это очень круто!!!
this is perfect
Yeah. Came up with this solution after ~ 2 hours of trying)
Very Clever! I did the same thing, but in 15 lines haha
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Personally I dislike falsy values. It makes the code a bit harder to understand. I tend to use boolean values instead when I can, always.
Thanks for explaining that to me. Now the whole solution makes sense!
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
Loading more items...