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.
Very nice! The whole solution worked for me in C# as well except for one test case:
Input: 100 19 1 180
Expected output : 1
I handled this edge case by adding an additional if condition:
if (sumOfMoney < priceOfGame)
Console.WriteLine(0);
else if (sumOfMoney < priceOfGame * 2)
Console.WriteLine(1);
else
{
//A.P. series based processing
}
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 →
Very nice! The whole solution worked for me in C# as well except for one test case:
Input: 100 19 1 180 Expected output : 1
I handled this edge case by adding an additional if condition: