Number of Burgers with No Waste of Ingredients
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class Solution { public List<Integer> numOfBurgers(int t, int c) { List<Integer> res = new ArrayList<>(); if(t % 2 != 0) return res; int h = t / 2; int z = h - c; if(z < 0 || c - z < 0) return res; res.add(z); res.add(c-z); return res; } } |