1276. Number of Burgers with No Waste of Ingredients¶ Time: Space: C++JavaPython 1 2 3 4 5 6 7 8 9 10 11 12class Solution { public: vector<int> numOfBurgers(int tomatoSlices, int cheeseSlices) { if (tomatoSlices % 2 == 1 || tomatoSlices < 2 * cheeseSlices || tomatoSlices > cheeseSlices * 4) return {}; int jumboBurgers = (tomatoSlices - 2 * cheeseSlices) / 2; return {jumboBurgers, cheeseSlices - jumboBurgers}; } }; 1 2 3 4 5 6 7 8 9 10class Solution { public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) { if (tomatoSlices % 2 == 1 || tomatoSlices < 2 * cheeseSlices || tomatoSlices > cheeseSlices * 4) return new ArrayList<>(); int jumboBurgers = (tomatoSlices - 2 * cheeseSlices) / 2; return List.of(jumboBurgers, cheeseSlices - jumboBurgers); } } 1 2 3 4 5 6 7 8class Solution: def numOfBurgers(self, tomatoSlices: int, cheeseSlices: int) -> list[int]: if tomatoSlices % 2 == 1 or tomatoSlices < 2 * cheeseSlices or tomatoSlices > cheeseSlices * 4: return [] jumboBurgers = (tomatoSlices - 2 * cheeseSlices) // 2 return [jumboBurgers, cheeseSlices - jumboBurgers]