Could we use a generic type here? So if a user input `Array[Double]`, it will return `Array[Map[Double, Int]]`.