• + 1 comment

    You can reuse the result of 1 to sqrt(N) to calculate the result of N. So, let 's think about dynamic programming approach.