You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: rmq.rb
    path of file: ./repos/algorithms/src
    
    the code of the file until where you have to start completion: # range minimum query, sparse table algorithm. O(nlogn) preprocess time
class
    
  def initialize(arr)
    n = arr.size
    @rmq = [arr]
    1.upto(n) do |j|
      break if 2**j > n
      cur = Array.new(n)
      0.upto(n-2**j){ |i| cur[i] = [@rmq[j-1][i], @rmq[j-1][i+2**(j-1)]].min }
      @rmq << cur
    end
  end