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.
Can someone explain why is 1 test case failing out of 52 in this code. Can someone find out the issue with this code
int howManyGames(int p, int d, int m, int s) {
int sum = 0;
int count = 0;
if (p > s) {
return 0;
}
while (sum<=s && p >= m) {
sum += p;
count++;
p -= d;
}
while (sum + m <= s) {
sum += m;
count++;
}
return count;
}
Cookie support is required to access HackerRank
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 →
int howManyGames(int p, int d, int m, int s) {
}