nums array.nums array and populate the HashMap with each element as the key and its index as the value.operations array.
a. For each operation, retrieve the index of the element to be replaced from the HashMap.
b. Replace the element at the retrieved index in the nums array with the new element.
c. Update the HashMap by setting the new element to the same index.nums array after applying all operations.