Salvage Humankind

Easyrubrik

Problem Overview

  • Support two operations on n rock masses: range sum query m[x..y] and range XOR update m[i] ^= z for x≤i≤y.
  • Input: n, initial masses, ops, then ops queries; output the total mass for each type-1 query.
  • Constraints: 1≤n≤1e5, 0≤m[i]≤1e6, 1≤ops≤5e4, 1-based indices; updates persist.
  • Set in a 5th-dimension scenario with Cooper and TARS transmitting gravitational data.
  • A Rubrik interviews coding interview problem and interview question on range queries and updates.

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: