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.
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 :)
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
Really nice kata, well done! In my humble opinion, this is a 3kyu though, quite a big harder than most 4kyu I think.
My tip would be to try and google it, see what you find for other languages, and try to extrapolate to python. Try googling something along the lines of returning a function from a function.
For me (as a relative novice), this problem seemed really difficult/strange to begin with. However, after understanding it better after som googling, I now think it's an extremely useful kata, and I would recommend everyone being stuck here to hang in there and try a little harder. GL :)
Really nice way of using a recursive method, really smooth.