Easy Beginner Friendly Solution in CPP || 0ms || Beats 100% || 0(1) Solution
Intuition\n Describe your first thoughts on how to solve this problem. \nThe code determines the quantities of jumbo and small burgers that can be made with a g
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe code determines the quantities of jumbo and small burgers that can be made with a given number of tomato and cheese slices, ensuring conditions for burger making are met.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1) We first checked if there are enough ingredients to make any burgers, returning an empty vector if not.\n\n2) Then, we verified if the given numbers of tomato and cheese slices falls within the acceptable range for burger making.\n\n3) If the conditions are met, it calculates and returns the quantities of jumbo and small burgers based on the number of tomato and cheese slices. If the number of tomato slices is odd, no burgers can be made.\n# Complexity\n- Time complexity: O(1)\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 {\npublic:\n    vector<int> numOfBurgers(int tomato, int cheese) {      \n        if(cheese > tomato){\n            return {};\n        }else{\n            if((tomato > cheese*4) || (tomato < cheese*2)){\n                return {};\n            }else{\n                if(tomato % 2 == 0){\n                    int x = tomato - (2*cheese);\n                    int y = x/2;\n                    int z = cheese-y;\n                    return {y,z};\n                }else{\n                    return {};\n                }\n            }\n        }\n    }\n};\n```
['C++']