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.
@Oleksandra28 I too didn't get that when I started the solution. But then it made sense after following the discussions here..
Think of this scenario. There are three inters with the chocolate count as follows: 5, 3, 3. In this case you can choose the intern with 5 chocolates and add 2 chocolates to other interns to make the chocolate count 5, 5, 5 or you can choose the intern with 5 chocolates and take 2 chocolates from him to make the chocolate count 3, 3, 3. Both require 1 operation. Does this make sense?
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 →
@Oleksandra28 I too didn't get that when I started the solution. But then it made sense after following the discussions here..
Think of this scenario. There are three inters with the chocolate count as follows: 5, 3, 3. In this case you can choose the intern with 5 chocolates and add 2 chocolates to other interns to make the chocolate count 5, 5, 5 or you can choose the intern with 5 chocolates and take 2 chocolates from him to make the chocolate count 3, 3, 3. Both require 1 operation. Does this make sense?