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.
Ya. I agree. I implemented in python in 5 mins using lists and the native .insert(0,x), .pop(), and myList[len(myList)-1] functionality. it passed all test cases with no issues.
I first attempted to handle the median computation problem that way but most of the test cases timed out. At least then I was motivated to figure out how to deal with heaps.
I only came in here to look because the problem seemed too easy. Now that I've looked here, IMO, this exercise feels like a lesson in over-engineering.
I think I'm concluding that I'd rather spend my time on another problem rather than digging in on this one.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Queues: A Tale of Two Stacks
You are viewing a single comment's thread. Return to all comments →
Ya. I agree. I implemented in python in 5 mins using lists and the native .insert(0,x), .pop(), and myList[len(myList)-1] functionality. it passed all test cases with no issues.
I first attempted to handle the median computation problem that way but most of the test cases timed out. At least then I was motivated to figure out how to deal with heaps.
I only came in here to look because the problem seemed too easy. Now that I've looked here, IMO, this exercise feels like a lesson in over-engineering.
I think I'm concluding that I'd rather spend my time on another problem rather than digging in on this one.