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.
As I understand it, you only used one loop to set both the left to right and right to left array, but to get the final answer you would still need to do another loop to choose the final values from these two arrays, so in that way even your method would require using 2 loops anyways.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Candies
You are viewing a single comment's thread. Return to all comments →
As I understand it, you only used one loop to set both the left to right and right to left array, but to get the final answer you would still need to do another loop to choose the final values from these two arrays, so in that way even your method would require using 2 loops anyways.