Leetcode 1401 Solution

This article provides solution to leetcode question 1401 (number-of-burgers-with-no-waste-of-ingredients)

https://leetcode.com/problems/number-of-burgers-with-no-waste-of-ingredients

Solution

class Solution:
    def numOfBurgers(self, tomatoSlices: int, cheeseSlices: int) -> List[int]:
        if tomatoSlices % 2 == 1:
            return []

        x = tomatoSlices // 2 - cheeseSlices
        y = cheeseSlices - x

        if x < 0 or y < 0:
            return []

        return [x, y]