Data Structures19 sections · 729 units
Open in Course

Problem - Range Minimum Query

The classic RMQ problem

Given an array of nn elements and qq queries, each asking for the minimum element in a range [l,r][l, r].

Example: arr =[1,3,2,7,9,11]= [1, 3, 2, 7, 9, 11]

  • Query (1,4)(1, 4): min of [3,2,7,9][3, 2, 7, 9] = 22
  • Query (0,2)(0, 2): min of [1,3,2][1, 3, 2] = 11 You're solving the textbook Sparse Table application. Constraints: nn up to 10510^5, qq up to 10610^6.