This question is straightforward enough. You could, theoretically, compute the solution simply by adding the numbers in sequence, like so: 1+2+3… But this is impractical and probably not what the interviewer is looking for. Fortunately, there’s a formula called a series sum. It’s the number multiplied by itself plus 1, and the resulting solution divided by 2.
n(n+1)/2
Sample answer: Thankfully, there’s a formula that can help with this: 100(100 + 1) = 10,100; 10,100 / 2 = 5,050.