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.
Mathematically it is easy to see that the program will always terminate, because after each iteration, the maximum number from the original list will never show up in the next list and the max keeps decreasing. The challenge, of course, is to figure out the exact number of steps it will take to terminate within the bounds of limited computation resources.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Iterate It
You are viewing a single comment's thread. Return to all comments →
Mathematically it is easy to see that the program will always terminate, because after each iteration, the maximum number from the original list will never show up in the next list and the max keeps decreasing. The challenge, of course, is to figure out the exact number of steps it will take to terminate within the bounds of limited computation resources.