/**
 * This exercise requires you to modify the given list by XORing each element with a key.
 *
 * @param nums A list of integers.
 * @param key An integer key to XOR with each element in the list.
 * @return The modified list after XORing each element with the key.
 */
fun modifyXorElements(nums: MutableList<Int>, key: Int): List<Int> {

    // Iterate over the list
    for (i in nums.indices) {
        // XOR each element with the key
        nums[i] = nums[i] xor key
    }
    
    return nums
}
/**
 * This exercise requires you to modify the given list by XORing each element with a key.
 *
 * @param nums A list of integers.
 * @param key An integer key to XOR with each element in the list.
 * @return The modified list after XORing each element with the key.
 */
fun modifyXorElements(nums: MutableList<Int>, key: Int): List<Int> {
/**
 * This exercise requires you to modify the given list by XORing each element with a key.
 *
 * @param nums A list of integers.
 * @param key An integer key to XOR with each element in the list.
 * @return The modified list after XORing each element with the key.
 */
fun modifyXorElements(nums: MutableList<Int>, key: Int): List<Int> {

    // Iterate over the list
    for (i in nums.indices) {
        // XOR each element with the key
        nums[i] = nums[i] xor key
    }
    
    return nums
}