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.
Because more beginners vote codes than experts
Same here! I didn't know where to start, but someone answered another comment with this link: https://medium.com/javascript-scene/composing-software-an-introduction-27b72500d6ea
This kata is challenging, but becomes simple once you apply this idea.
Thanks for your reply. And yeah, you are correct, after timing it on my machine I was surprised. It does seem strange in that it to me seems like you have to traverse the list twice with both the set() and count() operations (instead of just traversing the list once and breaking as soon as you find a unique value). Being wrong teaches you something new though :)
Spoiler flag?
This comment is hidden because it contains spoiler information about the solution
Very neat and elegant solution indeed. A bit funny though to consider that a solution like this has most votes on "Best Practice" given that the kata description explicitly states: "... so think about performance" :)
Agreed. I think it's a 7kyu without the negative/above 255 check, and with those checks a 6kyu (also for understanding hex).
See my explanation above to Yedya.
Think about yourself being at the supermarket where there are n self-service check-outs, and a line of customers, where you know how long time it takes for each customer. How long time does it take in total for all customers to check out? That's it.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Notwithstanding the empty array requirement, I find it interesting that this type of solution is rated lower than an O(n^2) solution, where you calculate a sum for each iteration, i.e. not making use of already used calculations. Any ideas why? Because the code is shorter simply?
[-10, 10] should return -1. You start at index 0, and here the left sum is 0 and right sum is 10. Next, index is 1, and here left sum is -10 and right sum is zero. You never go to index 2 (where the left sum would equal the right sum), since index 2 is not an index in the array.
This comment is hidden because it contains spoiler information about the solution
Haskell update to GHC 8.x
Loading more items...