Your question is Swap Two Values in Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
UT Austin's course scheduling tools sometimes reorder items represented as arrays. Given an integer array and two valid indices, swap the elements at those indices in place and return the modified array.
Implement swap_elements(nums, i, j):
nums is a mutable list of integers.i and j are zero-based indices in nums.nums directly rather than creating a second array.i and j are equal, leave the list unchanged.def swap_elements(nums, i, j):