O(1) Well commented || easy understanding
\nclass Solution {\npublic:\n    vector<int> numOfBurgers(int tomato, int cheese) {\n        \n        if(tomato % 2 == 1) return {}; //if number of tomatoes ar
```\nclass Solution {\npublic:\n    vector<int> numOfBurgers(int tomato, int cheese) {\n        \n        if(tomato % 2 == 1) return {}; //if number of tomatoes are odd it\'s not possible\n        \n        int l = tomato/4 + tomato%4; //setting a lower limit (i greedyly use as many jumbo as possible)\n        \n        if(tomato < 4)  l = 0; // if less than 4 tomatoes jumbo cant be used\n        \n        int h = tomato/2; //setting an upper limit (i greedyly use as many small as possible)\n        \n        if(cheese < l || cheese > h) return {}; //cheese should lie b/w the limits... why? simple logic cant produce more or less than that\n        \n        int small = h - (2*(h-cheese)); //number of small burgers (how this formula came check below)\n        \n        int big = cheese-small; // number of larger burgers\n        \n        return {big,small};\n    }\n};\n\n/*\n\n\nlet tomatoes = 20 and cheese = 7\n\nlet\'s find out if cheese lies within limits;\nl = 5 h = 10\nyes !!\n\nnow,\n2 2 2 2 2 2 2 2 2 2 => i need 10 cheese for this but have 7 (need to remove 3 cheese)\nin order to remove 3 cheese i will remove 6 2\'s and replace with 3 4\'s..\nthat is,\nnew small burgers = allFromSmall - (2*(allFromSmall - cheese));  ==> 10 - (2*(10-7)) ==>4\nnew big ones = cheese - smalls ==> 7-4 = 3\nans :: {3,4}\n\n\n*/\n```\n
['Greedy', 'C++']