thank you for the responses but i figured it out.
what i was doing wrong was as i was looping through the array, i was indeed removing the element at position
i but that also changed the size of my array. Which in the end, when
i increases, the array size decreases. therefore, when
i = 0 it removes element at position 0 which is 1 in this case, and decreases the size of the array by 1 which in this case would change from size 7 to size 6. Now when it removes element at position 1, position 1 of the array is 3 since we decreased the size of the array.