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.
another approach would be to select the second element and increase others by 5, generating (1, 5, 5) -> (6, 5, 10), then select the third element and increase others by 5 generating (6, 5, 10) -> (11, 10, 10), and finally select the first element and increase othters by 1, generating (11, 10, 10) -> (11, 11, 11) ...
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 →
another approach would be to select the second element and increase others by 5, generating (1, 5, 5) -> (6, 5, 10), then select the third element and increase others by 5 generating (6, 5, 10) -> (11, 10, 10), and finally select the first element and increase othters by 1, generating (11, 10, 10) -> (11, 11, 11) ...