You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
money -= children; //Distributing one coin to each children
int ans = money/7; // only 7 coins left to make it 8 hence divide to by 7 to get the number of children with 8 coins
// If number of children with 8 coins i.e ans is more than the given children then we can simply give all the remaining coins to one child and rest will have 8 coins hence returning children - 1;