Java Intuitive O(1) O(1) - Choose 1 type & convert
The idea is simple... start with all small (based on number of cheese slices), then see how many we need to convert to large to satisfy the target. If the numbe
The idea is simple... start with all small (based on number of cheese slices), then see how many we need to convert to large to satisfy the target. If the number of conversions we need to do is negative or greater than the number of smalls we have, it cannot be done.\n```\nclass Solution {\n    public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {\n        if (tomatoSlices % 2 == 1) return List.of();\n        \n        int nSmall = cheeseSlices; // assume all small\n        \n        int nTomatoSlicesLeft = tomatoSlices - nSmall * 2;\n        int nLarge = nTomatoSlicesLeft / 2;\n        \n        if (nLarge < 0) return List.of(); // smalls alone used more than available tomato slices\n        if (nLarge > nSmall) return List.of(); // not enough to convert\n        \n        nSmall -= nLarge;\n        \n        return List.of(nLarge, nSmall);\n    }\n}\n```
['Java']