Ad
  • Custom User Avatar

    So we have the initial sequence (seq = [0, 1, 2, 2]) and we are adding the next natural number after 2 which is 3. The number of 3s added to the list is determined by the integer at the 3rd index of seq (seq[3] == 2). So now we have [0, 1, 2, 2, 3, 3]. Next is 4 and we add three 4s because seq[4] == 3. Next we add three 5s because seq[5] == 3, and so on.