How to make array values MOVE UP

Performance-wise, pushing new elements to the head/top is the slowest, b/c it demands that all the others already inside the container to have their indices right-shifted in order to make room! :japanese_goblin:

Therefore, it’s much preferable to push new elements to the tail/bottom of a container, so there’s no index-shifting. :ok_hand:

Given those values you’re using are all int numbers, best container for them would be the IntList: :face_with_monocle:

Use its append() method in order to push a new int value to its tail: :sunglasses:

2 Likes