通过万岁!!!
java代码
class Solution {
public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {
int twoX = tomatoSlices - 2 * cheeseSlices;
if (twoX < 0 || (twoX) % 2 == 1) {
return new ArrayList<>();
} else {
if ((cheeseSlices - twoX / 2) < 0) {
return new ArrayList<>();
}
return Arrays.asList(new Integer[]{twoX / 2, cheeseSlices - twoX / 2});
}
}
}