You are viewing a single comment's thread. Return to all comments →
Node.js solution:
function howManyGames(p, d, m, s) { let gamesBought = 0; while(s >= p){ s -= p; p = Math.max(p - d, m); gamesBought++; } return gamesBought; }
Seems like cookies are disabled on this browser, please enable them to open this website
Halloween Sale
You are viewing a single comment's thread. Return to all comments →
Node.js solution:
function howManyGames(p, d, m, s) { let gamesBought = 0; while(s >= p){ s -= p; p = Math.max(p - d, m); gamesBought++; } return gamesBought; }