We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
A nice, clean and simple, but pretty effective way of solving this problem, thanks!
For fellow pythonistas; this approach also works well in Python3. I used array.array instead of a list, because I was afraid it might still time out too easily, but it would probably work just as well using plain old lists.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
A nice, clean and simple, but pretty effective way of solving this problem, thanks! For fellow pythonistas; this approach also works well in Python3. I used
array.array
instead of a list, because I was afraid it might still time out too easily, but it would probably work just as well using plain old lists.