Problem Statement  
Many monetary systems have the nice property that, when giving change, a greedy algorithm will always produce the fewest number of coins possible. In other words, if you are trying to produce a certain amount of change, then something like the following algorithm will produce the fewest coins possible: number of coins = 0; while(amount>0){ find the largest coin, c, that is less than or equal to amount; subtract the value of c from amount and increment the number of coins; } For example, the American monetary system with coins valued at 1, 5, 10, and 25 cents has this property. However, it is not difficult to construct values of coins that do not have this property. If the values of your coins are 1, 3 and 4, then you can make 6 with two 3's. The algorithm above, on the other hand, will use 3 coins  a 4 and two 1's. Your task is to write a class GreedyChange, with a method smallest that takes a int[], denominations, representing the values of the various coins in some monetary system. You should return the smallest amount of money for which the greedy algorithm does not produce the fewest coins possible. If the greedy algorithm always produces the fewest coins possible, return 1. To guarantee that the greedy algorithm always works (terminates), there will always be a coin worth 1.  
Definition  
 
Constraints  
  denominations will contain between 1 and 50 elements, inclusive.  
  Each element of denominations will be between 1 and 500,000, inclusive.  
  At least one of the elements of denominations will be 1.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
 
5)  
