1276. Number of Burgers with No Waste of Ingredients Medium

@problem@discussion
#Math



1/**
2 * [1276] Number of Burgers with No Waste of Ingredients
3 *
4 * Given two integers tomatoSlices and cheeseSlices. The ingredients of different burgers are as follows:
5 * 
6 * 	Jumbo Burger: 4 tomato slices and 1 cheese slice.
7 * 	Small Burger: 2 Tomato slices and 1 cheese slice.
8 * 
9 * 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 [].
10 *  
11 * Example 1:
12 * 
13 * Input: tomatoSlices = 16, cheeseSlices = 7
14 * Output: [1,6]
15 * Explantion: To make one jumbo burger and 6 small burgers we need 4*1 + 2*6 = 16 tomato and 1 + 6 = 7 cheese.
16 * There will be no remaining ingredients.
17 * 
18 * Example 2:
19 * 
20 * Input: tomatoSlices = 17, cheeseSlices = 4
21 * Output: []
22 * Explantion: There will be no way to use all ingredients to make small and jumbo burgers.
23 * 
24 * Example 3:
25 * 
26 * Input: tomatoSlices = 4, cheeseSlices = 17
27 * Output: []
28 * Explantion: Making 1 jumbo burger there will be 16 cheese remaining and making 2 small burgers there will be 15 cheese remaining.
29 * 
30 *  
31 * Constraints:
32 * 
33 * 	0 <= tomatoSlices, cheeseSlices <= 10^7
34 * 
35 */
36pub struct Solution {}
37
38// problem: https://leetcode.com/problems/number-of-burgers-with-no-waste-of-ingredients/
39// discuss: https://leetcode.com/problems/number-of-burgers-with-no-waste-of-ingredients/discuss/?currentPage=1&orderBy=most_votes&query=
40
41// submission codes start here
42
43impl Solution {
44    pub fn num_of_burgers(tomato_slices: i32, cheese_slices: i32) -> Vec<i32> {
45        vec![]
46    }
47}
48
49// submission codes end
50
51#[cfg(test)]
52mod tests {
53    use super::*;
54
55    #[test]
56    fn test_1276() {
57    }
58}
59


Back
© 2025 bowen.ge All Rights Reserved.