✅ Detailed explanation of the solution and math behind it || Javascript
Intuition\nWe are given a positive integer \'n\'\n    - break \'n\' into k positive integers (k >= 2) such that (Sum of k positive integers) = n\n    - among al
# Intuition\nWe are given a positive integer \'n\'\n    - break \'n\' into k positive integers (k >= 2) such that ***(Sum of k positive integers) = n***\n    - among all the possibilities find the ***Maximum product of the k integers***\n    \n    n = n1 + n2 + n3 +...+ nk , k positive integers\n                                where n1, n2,...nk > 0\n    obtain Maximum(n1 * n2 * ....* nk)\n\n# Explanation\n\nWhen an integer is to break in two parts, then to maximize the product those both parts should be equal. Using this concept lets break n into x\'s (n/x), then their product will be x ^ (n/x).\n\n### *Mathematical analysis* {to be familiar with calculus}\nImplement a maxima-minima concept : (out of scope but relatable)\n-   Extrema of a function are the maximum and minimum points. Maxima and minima are the highest and lowest values of a function within a set of ranges. \n- The largest value of the function in the full range is called the "absolute maximum", and the smallest value is called the "absolute minimum"\n- While the least value is known as the absolute minima. Other peaks and minima of a function are known as local maxima and minima, and they are not the absolute maxima and minima of the function. Let\u2019s take a closer look at local maxima and minima, absolute maxima and minima, and how to calculate the function\u2019s maximum and minima.\n\nMaxima and Minima properties :\n\n- If f(x) is a continuous function in its domain, then there should be at least one maximum and one minimum between equal values of f(x) .\n\n- The maxima and minima alternate. In other words, there is one minimum between two maxima and vice versa.\n\n- If f(x) approaches infinity as x approaches an or b, and f\'(x) = 0 for exactly one value x, namely c between a and b, then f(c) is the lowest and least value. If f(x) tends to \u2013 as x tends to an or b, f(c) is the greatest and most extreme value.\n\nif we take derivative of the obtained product and make that equal to 0 for maxima, we will get to know that valud of x tends to e (base of the natural algorithm) for maximum product. \n\n**2 < e < 3**\n\nwe need to break the integer into 2 or 3 only for maximum product.\n\n### *Pattern approach*\n\nThe maximum product can be obtained by recursively removing the size of integer 3 from the given number \'n\' when n > 4.\n\nWhen \'n\' reaches the condition of n <= 4, conclude the last part as size of 2 or 3 or 4\n\nFor example.,\n-   n = 10 -> equivalent positive integer sum = 3 + 3 + 4 | maximum product = 3 * 3 * 4\n-   n = 11 -> equivalent posive integer sum = 3 + 3 + 3 + 2 | maximum product = 3 * 3 * 3 * 2\n\n# Complexity\n- Time complexity: O(N * 1/3)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nvar integerBreak = function(n) {\n\n    // handling two base cases\n    if(n === 2 || n === 3) return n-1;    \n\n    let maxProduct = 1;\n    \n    // remove the integer 3 recursively from n when (n > 4)\n    while(n > 4){\n        n -= 3;\n        maxProduct *= 3;\n    }\n    \n    // for the last part of the number when (n <= 4)\n    maxProduct *= n;\n    return maxProduct;\n};\n```
['JavaScript']