One more tag should be added to this problem "Math"

  • 3

    This problem is heavily math based. The Math tag should be added to this problem.

    General technique for solving problems like this.

    Without being a genius the only way to solve problems like this is to use whats known as the Examplify Technique In the Examplify technique you write out specific examples of the problem and see if you can derive a general rule (or pattern) from there. In this case write out by hand what will happen when n = 1 then n = 2 then n = 3 then n = 4, and so on until you are able to figure out the pattern. This approach isn't the fastest but its a decent approach when you are unable to think of a solution off of the top of your head.

    many others have provided the answer to this problem but the answer to this one problem isn't the important part being able to come up with solutions is what matters.

  • 0

    Thanks, I've just added the Math tag.

Log in to reply

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