function chocolateFeast(n, c, m) {
let candy = Math.floor(n / c);
let wrapper = candy;
let result = candy;
while(wrapper >= m) {
const exchanged = Math.floor(wrapper / m);
wrapper = wrapper - (exchanged * m) + exchanged;
result+= exchanged;
}
return result;
}
chocolateFeast(10, 2, 5);
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)