Precompute the whole thing?

  • 1

    There are only 1000 different possible inputs for the function. What if you precalculated the answer for each n and put them in a hard-coded array?

    I tried that after the contest ended and got Accepted.

  • 0

    You made it!! Congratulations!!
    // I also want to do it, but never tried.

Log in to reply

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