Get Sequence Sum

Problem Overview

  • Compute the sum of a number sequence that starts at i, increases by 1 to j, then decreases by 1 to k, as described.
  • Input: three integers i, j, k; Output: a long integer sum. Constraints: -1e8 ≤ i, j, k ≤ 1e8 and i, k ≤ j.
  • Domain: arithmetic series and sequence processing in math-focused programming.
  • Source: Ibm interviews; a classic coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: