Straightforward Math Solution (Detailed)
Since we are given the total number of cheese and tomato slices along with the cost for creating a jumbo and small burger we can setup a system of equations qui
Since we are given the total number of cheese and tomato slices along with the cost for creating a jumbo and small burger we can setup a system of equations quite easily by noting that:\n```\ncheeseSlices = numJumboBurgers * (cheeseSlice/JumboBurger) + numSmallBurgers * (cheeseSlice/SmallBurger)\ntomatoSlices = numJumboBurgers * (tomatoSlice/JumboBurger) + numSmallBurgers * (tomatoSlice/SmallBurger)\n```\n\nNow we are given that cheeseSlice/JumboBurger = 1, cheeseSlice/SmallBurger = 1, tomatoSlice/JumboBurger = 4, tomatoSlice/SmallBurger = 2. \n\nFor simplicity let X = numJumboBurgers and Y = numSmallBurgers, then our system of equations becomes:\n\n```\ncheeseSlices = X * 1 + Y * 1 => Y = cheeseSlices - X\ntomatoSlices = X * 4 + Y * 2 => tomatoSlices = 4X + 2 * (cheeseSlices - X) = 2X + 2 * cheeseSlices\n```\n\nTherefore, ```X = (tomatoSlices - 2 * cheeseSlices) / 2``` and this can be substituted into\n```Y = cheeseSlices - X``` to find Y.\n\nNow to ensure the solution is valid we must enforce that X and Y are positive integers. This leads to the constraints: X >= 0, Y >= 0, and X * 4 + Y * 2 == tomatoSlices (Last equality verifies that there was no remainder during the divisions)\n\nCode:\n```Java\npublic List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) \n{\n\tList<Integer> ans = new ArrayList<Integer>();\n\n\tint X = (tomatoSlices - 2 * cheeseSlices) / 2;\n\tint Y = cheeseSlices - X;\n\n\tif (X * 4 + Y * 2 == tomatoSlices && X >= 0 && Y >= 0)\n\t{\n\t\tans.add(X);\n\t\tans.add(Y);\n\t}\n\n\treturn ans;\n}\n```\n\n
[]