Given two integers tomatoSlices and cheeseSlices. The ingredients of different burgers are as follows:


	Jumbo Burger: 4 tomato slices and 1 cheese slice.
	Small Burger: 2 Tomato slices and 1 cheese slice.


Return [total_jumbo, total_small] so that the number of remaining tomatoSlices equal to 0 and the number of remaining cheeseSlices equal to 0. If it is not possible to make the remaining tomatoSlices and cheeseSlices equal to 0 return [].

&nbsp;
Example 1:

Input: tomatoSlices = 16, cheeseSlices = 7
Output: [1,6]
Explantion: To make one jumbo burger and 6 small burgers we need 4*1 + 2*6 = 16 tomato and 1 + 6 = 7 cheese.
There will be no remaining ingredients.


Example 2:

Input: tomatoSlices = 17, cheeseSlices = 4
Output: []
Explantion: There will be no way to use all ingredients to make small and jumbo burgers.


Example 3:

Input: tomatoSlices = 4, cheeseSlices = 17
Output: []
Explantion: Making 1 jumbo burger there will be 16 cheese remaining and making 2 small burgers there will be 15 cheese remaining.


&nbsp;
Constraints:


	0 &lt;= tomatoSlices, cheeseSlices &lt;= 107


class Solution(object):
    def numOfBurgers(self, t, c):
        
        if t==c==0:
            return [0,0]
        four=(t-2*c)//2  # no of jumbo burgers by solving 4x+2y=t and x+y=c
        two=c-four #number of small burgers
        if c>=t or (t-2*c)%2==1 or four<0 or two<0: #if cheese is less than tomatoes or if number of jumbo burgers is a decimal or number of burgers are negtive we return empty list
            return []
        
        return [four,two]
        
class Solution {
    public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {
        List<Integer>list=new ArrayList<>();
        int ts=tomatoSlices;
        int cs=cheeseSlices;
        if (ts<cs*2 || ts>cs*4 || ts%2!=0 || (ts==0 && cs>0) || (cs==0 && ts>0))
        {
            return list;
        }
        int cnt=0;
        while(ts>0 && cs>0 && ts!=cs*2)
        {
            ts-=4;
            cnt++;
            cs--;
        }
        list.add(cnt);
        list.add(cs);
        return list;
    }
}
class Solution {
public:
    vector<int> numOfBurgers(int tomatoSlices, int cheeseSlices) {
        // Observation
        // Total Number of Burgers is Equal to Number of cheeseSlices
        // Try to make 1 --> cheeseSlices Amount of Jumbo Burgers and
        // remaining will be Small Burger
        vector <int> ans;
        if(tomatoSlices == 0 and cheeseSlices == 0) {
            ans.push_back(0), ans.push_back(0);
            return ans;
        }
        // Do Binary Search to Get Ideal Division.
        int low = 0, high = cheeseSlices;
        while(low < high) {
            int mid = (low + high) / 2;
            int jumbo = mid, small = cheeseSlices - mid;
            // Jumbo needs 4 tomatoes per burger
            // Small needs 2 tomatoes per burger
            int needJumboTom = jumbo * 4;
            int needSmallTom = small * 2;
            // Should Add Upto tomatoSlices
            if(needJumboTom + needSmallTom == tomatoSlices) {
                ans.push_back(jumbo), ans.push_back(small);
                break;
            } else if(needJumboTom + needSmallTom < tomatoSlices) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return ans;
    }
};
/**
 * @param {number} tomatoSlices
 * @param {number} cheeseSlices
 * @return {number[]}
 */
var numOfBurgers = function(tomatoSlices, cheeseSlices) {
    if (tomatoSlices & 1) return []; // return [] if tomatoSlices is odd
    const j = (tomatoSlices >> 1) - cheeseSlices; // jumbo = (tomatoSlices / 2) - cheeseSlices
    return j < 0 || j > cheeseSlices ? [] : [j, cheeseSlices - j]; // small = cheeseSlices - jumbo, if any of jmbo and small < 0 return [] otherwise return [jumbo, small]
};
Number of Burgers with No Waste of Ingredients