Lemonade Change using Switch case
Intuition\nTo solve the problem you just need to know the switch case,increment decrement and condtional statement.\n\n# Approach\nyou need to assign a varaible
# Intuition\nTo solve the problem you just need to know the switch case,increment decrement and condtional statement.\n\n# Approach\nyou need to assign a varaible for each number\n```\n int sum5 = 0, sum10 = 0,sum20 = 0;\n```\n1. Then create a for loop and set the condition as the array length\n2. Inside the for loop assign the switch case with three conditions:\n> switch(arr[i]){\ncase 5:\ncase 10:\ncase 20:\n}\n3. In each case set the increament of the variable\n4. then give condiotion if the previous increament is above the specific count else return **false**\n```\nif(sum5 > 0)\nif(sum5 > 0 && sum10 > 0)\n```\n5. then  finally return **true**\n\n\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public boolean lemonadeChange(int[] bills) {\n        int sum5 = 0, sum10 = 0,sum20 = 0;\n        for(int i =0 ;i<bills.length;i++){\n\n            switch(bills[i]){\n                case 5:\n                     sum5++;\n                break;\n                case 10:\n                    if(sum5 > 0){\n                    sum5--;\n                    sum10++;\n                    }else{\n                        return false;\n                    }\n                break;\n\n                case 20:\n                    if(sum5 > 0 && sum10 > 0){\n                    sum20++;\n                    sum5--;\n                    sum10--;\n                    }else if(sum5>2){\n                        sum20++;\n                        sum5 -=3; \n                    }else{\n                        return false;\n                    }\n                break;\n            }\n            \n        }\n\n        return true;\n    }\n}\n```
['Array', 'Greedy', 'Java']