Array addition

1. For example, if 1 2 3 4 5 is deleted, does 3 become 1 2 4 5. Think about it,

1. Deletion causes element reduction

The position 2, 4 is 3, and the position 5 is 4

Summary: The so-called deletion logic is that the next number covers the previous number, and the final number is reduced by 1.
to sum up:

1. Perform the add operation first, and then perform the operation of array length + 1

2. The element just added is at the end of the array

3. Here is the number, sorted in ascending or descending order, it's up to you, using the method of my first blog

Guess you like

Origin blog.csdn.net/LiAiZu/article/details/83688081