using System.Collections.Generic;
public class Solution : ISolution
public Solution(APICaller api)
Console.WriteLine("Press run code to see this in the console!");
public int SmallestUnreachable()
int numberOfDenominations = api.GetNumBills();
int[] denominations = new int[numberOfDenominations];
for (int i = 0; i < numberOfDenominations; i++)
denominations[i] = api.GetBill(i);
Array.Sort(denominations);
foreach(int denomination in denominations)
if(denomination <= minUnreachable){
minUnreachable += denomination;
Console.WriteLine("Minimum unreachable amount is: $" + minUnreachable);
int numberOfDenominations = api.GetNumBills();
int[] denominations = new int[numberOfDenominations];
for (int i = 0; i < numberOfDenominations; i++)
denominations[i] = api.GetBill(i);
int price = api.GetPrice();
int payment = api.GetPayment();
int change = payment - price;
int minBills = calculateMinBills(denominations, change);
public int calculateMinBills(int[] denominations, int change)
Array.Sort(denominations, (a,b) => b.CompareTo(a));
while (change > 0 && index < denominations.Length)
if (denominations[index] <= change)
int count = change / denominations[index];
change -= count * denominations[index];