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.
Looks the question is changed from using {5, 2, 1} to {5, 3, 1}, so we might need to change the number value in above code. Otherwise given input {2, 2, 5, 7}, it will give answer 3, but it could be 2.
But the test cases are not updated, so this answer will pass all test cases.
One more comment, we just need to concern about base in [0: 4], as if base is 5, there will be definitely one more operation needed.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal
You are viewing a single comment's thread. Return to all comments →
Looks the question is changed from using {5, 2, 1} to {5, 3, 1}, so we might need to change the number value in above code. Otherwise given input {2, 2, 5, 7}, it will give answer 3, but it could be 2. But the test cases are not updated, so this answer will pass all test cases. One more comment, we just need to concern about base in [0: 4], as if base is 5, there will be definitely one more operation needed.