768. Different Series
Return the nth term of the series given by:
- xi = i + xi-1 + 1, where n1 is the 1st term of the series and has value = 1.
Example 1:
Input: n = 3
Output: 8
Explanation: n2 = 2 + n1 + 1 = 2 + 1 + 1 = 4
n3 = 3 + n2 + 1 = 3 + 4 + 1 = 8
Example 2:
Input: n = 4
Output: 13
Explanation: n4 = 4 + n3 + 1 = 4 + 8 + 1 = 13
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= n <= 1000