Delete element at index from an array by swapping it with the last element and then truncating.
Array to delete in
Index to delete
Swapped element, if any
Delete element at index from an array by swapping it with the last element and then truncating.