Delete an element from an array by swapping it with the last element and then truncating.
Array to delete in
Element to delete
Swapped element, if found
Delete an element from an array by swapping it with the last element and then truncating.