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.
Halloween Sale
Halloween Sale
Sort by
recency
|
676 Discussions
|
Please Login in order to post a comment
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; }
Why so many test cases?
public static int howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy
Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-halloween-sale-problem-solution.html