Browse and switch challenges
Range Sum with Updates

Process updates and range-sum queries on an integer array and return the results of sum queries.

Important

  • -set i v updates a[i] = v.
  • -sum l r returns inclusive sum from l to r.
Signature
Constraints
  • -|nums|, |ops| ≤ 1e5
Examples
    System prompt
    0 tokens
    Read-only
    // Waiting for generated code…
    // Your output will appear here as soon as the model returns JavaScript.
    // It must define function segment(…).
    // Tip: write a prompt on the left and click "Generate code" .
    0 tokens
    Submission #1
    0tokens(0/0)
    Leaderboard
    Loading leaderboard...