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.
Hi Gareth. I reverse the list because it is more efficient. The list is implemented as an array, so the time complexity to pop(0) is O(n) while pop(last) is O(1).
Yep, your solution is clear and straightforward, definitely better. Thanks for sharing.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
Hi Gareth. I reverse the list because it is more efficient. The list is implemented as an array, so the time complexity to pop(0) is O(n) while pop(last) is O(1). Yep, your solution is clear and straightforward, definitely better. Thanks for sharing.