/**
 * Given two lists, find the common elements between them and modify each element of the second list by multiplying it by 2.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements between list1 and modified elements of list2.
 */
fun getCommonElements(list1: List<Int>, list2: MutableList<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate over elements in list1
    for (element1 in list1) {
        // Iterate over elements in list2
        for (i in list2.indices) {
            // Check if the elements are equal
            if (element1 == list2[i]) {
                // Modify the element in list2 by multiplying it by 2
                list2[i] *= 2
                // Add the common element to commonElements list
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}
/**
 * Given two lists, find the common elements between them and modify each element of the second list by multiplying it by 2.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements between list1 and modified elements of list2.
 */
fun getCommonElements(list1: List<Int>, list2: MutableList<Int>): List<Int> {
/**
 * Given two lists, find the common elements between them and modify each element of the second list by multiplying it by 2.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements between list1 and modified elements of list2.
 */
fun getCommonElements(list1: List<Int>, list2: MutableList<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate over elements in list1
    for (element1 in list1) {
        // Iterate over elements in list2
        for (i in list2.indices) {
            // Check if the elements are equal
            if (element1 == list2[i]) {
                // Modify the element in list2 by multiplying it by 2
                list2[i] *= 2
                // Add the common element to commonElements list
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}