Data Structures•Easy
Insert in Array
Inserting an Element

To insert an element at a given index idx in an array of size N, you must shift all elements from index idx to N-1 one position to the right to make space for the new element. The total number of elements increases by 1.
Edge Cases
- Array is full: Cannot insert without reallocating (or throwing an error).
- Invalid index: Index is less than 0 or greater than
N.