One loop, simple code, Easy to understand (JS)
Intuition\nSplit the number into multiples of 3 and 2 (2 multiplied only if 3 is not possible).\n\n# Approach\n1. First if the number is less than 4 then the ou
# Intuition\nSplit the number into multiples of 3 and 2 (2 multiplied only if 3 is not possible).\n\n# Approach\n1. First if the number is less than 4 then the output will be n-1 (for 2 & 3)\n2. Then initialize a variable for storing output\n3. use a while loop till n exits, inside loop we decrease n each time with 3 till n < 4. each time we decrease we multiply variable "out" with 3.\n4. if the "n" after decreasing satisfies else condition given (n<=4) then there is only 3 conditions to check n=4, n=3, n= 2 or 1; \n5. if n=4 its out * 2 * 2, n=3 its out * 3, else out * 2\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity:O(1)\n\n# Code\n```\n/**\n * @param {number} n\n * @return {number}\n */\nvar integerBreak = function (n) {\n    if (n < 4) return n - 1\n    let out = 1;\n    \n    while (n) {\n        if (n > 4) { \n            n = n - 3;\n            out = out * 3;\n        }\n        else if (n === 4) {\n            out = out * 4;\n            break;\n        } else if (n === 3) {\n            out = out * 3;\n            break;\n        } else {\n            out = out * 2;\n            break;\n        }\n    }\n    return out\n}\n```
['JavaScript']