You are given a 2D array segments, where segments[i] = [l_i, r_i, v_i] means every integer position from l_i to r_i (inclusive) carries the value v_i. The segments are non-overlapping, and positions outside every segment carry 0.
You are also given an integer k. Choose k consecutive integer positions and collect the values of all of them.