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.
public static List<int> stones(int n, int a, int b)
{
HashSet<int> possibleStones = new HashSet<int>();
for(int i = 0; i < n; i++)
possibleStones.Add((n - i - 1)*a + (i*b));
List<int> possibleStonesSorted = possibleStones.ToList();
possibleStonesSorted.Sort();
return possibleStonesSorted;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Manasa and Stones
You are viewing a single comment's thread. Return to all comments →
C# Solution