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.
Great solution, however you can replace the while statement in your balance() function with an if statement and still get the same result, since it is impossible for queues to get unbalanced by more than just the head.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Heaps: Find the Running Median
You are viewing a single comment's thread. Return to all comments →
Great solution, however you can replace the while statement in your balance() function with an if statement and still get the same result, since it is impossible for queues to get unbalanced by more than just the head.