✅💯🔥Simple Code📌🚀| 🔥✔️Easy to understand🎯 | 🎓🧠Beginner friendly🔥| O(n) Time Complexity💀💯
Solution tuntun mosi ki photo ke baad hai. Scroll Down\n\n# Code\njava []\nclass Solution {\n    public boolean lemonadeChange(int[] bills) {\n        int curr1
Solution tuntun mosi ki photo ke baad hai. Scroll Down\n![fd9d3417-20fb-4e19-98fa-3dd39eeedf43_1723794694.932518.png](https://assets.leetcode.com/users/images/a492c0ef-bde0-4447-81e6-2ded326cd877_1724187540.6168394.png)\n# Code\n```java []\nclass Solution {\n    public boolean lemonadeChange(int[] bills) {\n        int curr10=0;\n        int curr5=0;\n        for(int i=0; i<bills.length; i++){\n            if(bills[i]==5){\n                curr5++;\n            }else if(bills[i]==10){\n                curr10++;\n                if(curr5!=0){\n                    curr5--;\n                }else{\n                    return false;\n                }\n            } else{\n                if(curr5>0){\n                    if(curr10>0){\n                        curr5--;\n                        curr10--;\n                    }else{\n                        if(curr5>=3){\n                            curr5-=3;\n                        }else{\n                            return false;\n                        }\n                    }\n                }else{\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n}\n```\n![7be995b4-0cf4-4fa3-b48b-8086738ea4ba_1699897744.9062278.jpeg](https://assets.leetcode.com/users/images/fe5117c9-43b1-4ec8-8979-20c4c7f78d98_1721303757.4674635.jpeg)
['Array', 'Greedy', 'C', 'Python', 'C++', 'Java', 'JavaScript']