Practice Number of Burgers with No Waste of Ingredients
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
A jumbo burger needs four tomato slices and one cheese slice; a small burger needs two tomato slices and one cheese slice. Return [total_jumbo,total_small] using nonnegative whole burger counts that consume exactly tomatoSlices and cheeseSlices. Return [] if no such combination exists.
Source: Number of Burgers with No Waste of Ingredients on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
tomatoSlices = 16, cheeseSlices = 7
[1,6]
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
tomatoSlices = 17, cheeseSlices = 4
[]
There will be no way to use all ingredients to make small and jumbo burgers.
# Example 3
tomatoSlices = 4, cheeseSlices = 17
[]
Making 1 jumbo burger there will be 16 cheese remaining and making 2 small burgers there will be 15 cheese remaining.
Constraints
Related LeetCode Problems
Practice more problems similar to Number of Burgers with No Waste of Ingredients.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.