Java Solution for beginners | Greedy approach
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public boolean lemonadeChange(int[] bills) {\n        int fiveDollar = 0;\n        int tenDollar = 0;\n\n        for(int bill : bills){\n            if(bill == 5){\n                fiveDollar++;\n            }\n            else if(bill == 10){\n                if(fiveDollar>0){\n                    fiveDollar--;\n                    tenDollar++;\n                }else{\n                    return false;\n                }\n            }else{\n                if(tenDollar>0 && fiveDollar>0){\n                    fiveDollar--;\n                    tenDollar--;\n                }\n                else if(fiveDollar>=3){\n                    fiveDollar-=3;\n                }else{\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n}\n```
['Java']