Fast, Accepted O(1) || C/JAVA Code || BEATS 100%
Complexity\n- Time complexity : O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \n\n# JAVA\n
# Complexity\n- Time complexity : **O(1)**\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# JAVA\n -- | Details | --\n -- | -- | --:\n**Runtime** | **1** *ms* | *Beats* **100%**\n**Memory** | **40** *MB* | *Beats* **70%**\n```\nclass Solution {\n    public List<Integer> numOfBurgers(int tSlices, int cSlices) {\n        List<Integer> result = new ArrayList<Integer>();\n        int x = tSlices - 2*cSlices;\n        int y = cSlices - x/2;\n        if(x<0 || x%2!=0 || y<1 )\n            if(tSlices!=0 || cSlices!=0)\n                return result;\n        result.add(x/2); result.add(y);\n        return result;\n    }\n}\n```\n# C\n -- | Details | --\n--- | --- | ---:\n**Runtime** | **3** *ms* | *Beats* **100%**\n**Memory** | **5** *MB* | *Beats* **100%**\n```\nint* numOfBurgers(int tSlices, int cSlices, int* returnSize){\n    *returnSize = 0;\n    int *result;\n    int x = tSlices-2*cSlices;\n    int y = cSlices-x/2;\n    if(x<0 || x%2 || y<1 )\n        if(tSlices || cSlices)\n            return result;\n    *returnSize = 2;\n    result = (int *)malloc(sizeof(int)*2);\n    result[0] = x/2; result[1] = y;\n    return result;    \n}\n```\n## Tom need a UPVOTE : |\n![waiting-tom-and-jerry.gif](https://assets.leetcode.com/users/images/4f0cc754-71e1-4cfc-816b-36a94c20b17f_1678366238.9546802.gif)
['Math', 'C', 'Python', 'C++', 'Java']