Simple 1 line js solution


  • 0
    Z

    var integerBreak = function(n)
    {
    return [0,0,1,2,4,6,9].concat(new Array(n).fill(0)).map((e,i,arr)=>{return (i>6)?arr[i] = 3 * arr[i-3] : arr[i]})[n]
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.