The Oracles

Problem Overview

  • Starting with an empty array, perform two operations (append x; repeat array x times) and answer what value lies at each queried index.
  • Input: n operations (b_i, x_i) and q indices q_j; Output: q values; Constraints: n,q <= 1e5, copy x up to 1e9, indices up to min(1e18, final size).
  • Real-world context: Oracles’ game from Rick and Morty about array construction and index queries.
  • From Rubrik interviews; a coding interview problem suited as an 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: