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.
Can someone tell why are the example inputs separated as they are? Take the second one as example, why crate one has 3 elements (9 9 9) while crate two has 2 elements (2 2)? Take a similar example, but with candies = (9 9 9 10 2). Using the same separation of boxes like the example (which is what I dont understand), the result would be = (9 9 9) (10 2) = 9 + 10 = 19.
However, since only the last color repeats, the logical separation of boxes for me would be (9 9 9 10) and (2), which is = 10 + 2 = 12.
Am I missing something?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Candy Collection
You are viewing a single comment's thread. Return to all comments →
Can someone tell why are the example inputs separated as they are? Take the second one as example, why crate one has 3 elements (9 9 9) while crate two has 2 elements (2 2)? Take a similar example, but with candies = (9 9 9 10 2). Using the same separation of boxes like the example (which is what I dont understand), the result would be = (9 9 9) (10 2) = 9 + 10 = 19. However, since only the last color repeats, the logical separation of boxes for me would be (9 9 9 10) and (2), which is = 10 + 2 = 12.
Am I missing something?