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.
public static int chocolateFeast(int n, int c, int m)
{
int chacos=n/c;
int wrappers=chacos;
while(wrappers>=m)
{
var temp=wrappers/m; //used and got chacos
wrappers%=m; //leftover wrappers
chacos+=temp; // increasing chacos count
wrappers+=temp; // As I got new chacos, i will have new wrappers too.
}
return chacos;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
public static int chocolateFeast(int n, int c, int m) {