/**
 * Given a list of integers (nums) and an operation, modify each element in the list based on the operation.
 *
 * @param nums A list of integers.
 * @param operation A string representing the operation to be performed on the elements. It can be one of the following:
 * - 'increment': Increment each element by 1.
 * - 'decrement': Decrement each element by 1.
 * - 'double': Double each element.
 * - 'half': Divide each element by 2.
 * @return A list of the modified integers after performing the specified operation.
 */
fun modifyElements(nums: List<Int>, operation: String): List<Int> {

    val modifiedNums = mutableListOf<Int>()

    // Iterate over each element in nums
    for (num in nums) {
        // Apply the corresponding operation to the element
        when (operation) {
            "increment" -> modifiedNums.add(num + 1)
            "decrement" -> modifiedNums.add(num - 1)
            "double" -> modifiedNums.add(num * 2)
            "half" -> modifiedNums.add(num / 2)
            // Add other operations here
        }
    }

    return modifiedNums
}
/**
 * Given a list of integers (nums) and an operation, modify each element in the list based on the operation.
 *
 * @param nums A list of integers.
 * @param operation A string representing the operation to be performed on the elements. It can be one of the following:
 * - 'increment': Increment each element by 1.
 * - 'decrement': Decrement each element by 1.
 * - 'double': Double each element.
 * - 'half': Divide each element by 2.
 * @return A list of the modified integers after performing the specified operation.
 */
fun modifyElements(nums: List<Int>, operation: String): List<Int> {
/**
 * Given a list of integers (nums) and an operation, modify each element in the list based on the operation.
 *
 * @param nums A list of integers.
 * @param operation A string representing the operation to be performed on the elements. It can be one of the following:
 * - 'increment': Increment each element by 1.
 * - 'decrement': Decrement each element by 1.
 * - 'double': Double each element.
 * - 'half': Divide each element by 2.
 * @return A list of the modified integers after performing the specified operation.
 */
fun modifyElements(nums: List<Int>, operation: String): List<Int> {

    val modifiedNums = mutableListOf<Int>()

    // Iterate over each element in nums
    for (num in nums) {
        // Apply the corresponding operation to the element
        when (operation) {
            "increment" -> modifiedNums.add(num + 1)
            "decrement" -> modifiedNums.add(num - 1)
            "double" -> modifiedNums.add(num * 2)
            "half" -> modifiedNums.add(num / 2)
            // Add other operations here
        }
    }

    return modifiedNums
}