[JAVA] Straight forward | Greedy
The reason this problem is classified under greedy is we choose to return the maximum denomination everytime we return the change to a customer.\n2. We return m
1. The reason this problem is classified under greedy is we choose to return the maximum denomination everytime we return the change to a customer.\n2. We return maximum denomination because we can use smaller changes for future and we can build a bigger sum of change using the smaller denomination.\n3. My solution includes tracking the 20 denomination, but you never will be using it because you never return back a 20 denomination to the customer. You will either return a 10, 5 or the combination of both. But I have included 20 denomination for making the code more understandable for readers.\n\n\n```\nclass Solution {\n    public boolean lemonadeChange(int[] bills) {\n        int five = 0;\n        int ten = 0;\n        int twenty = 0;\n        \n        for(int i = 0; i < bills.length; i++){\n            if(bills[i] == 5) { five++; bills[i] -= 5;}\n            if(bills[i] == 10) { ten++; bills[i] -= 5; }\n            if(bills[i] == 20) { twenty++; bills[i] -= 5; }\n            \n            if(bills[i] > 0){\n                while(bills[i] >= 20 && twenty > 0){\n                    twenty--;\n                    bills[i] -= 20;\n                }\n                \n                while(bills[i] >= 10 && ten > 0){\n                    ten--;\n                    bills[i] -= 10;\n                }\n                \n                while(bills[i] >= 5 && five > 0){\n                    five--;\n                    bills[i] -= 5;\n                }\n                \n                if(bills[i] > 0) return false;\n            } \n        }\n        \n        return true;\n    }\n}\n```
['Greedy', 'Java']