/**
 * Given two arrays arr1 and arr2, find their intersection.
 *
 * @param arr1 A list containing integers
 * @param arr2 A list containing integers
 * @return A list containing the common elements between arr1 and arr2
 */
fun intersection(arr1: List<Int>, arr2: MutableList<Int>): List<Int> {

    val result = mutableListOf<Int>()

    for (i in arr1.indices) {
        if (arr1[i] in arr2) {
            result.add(arr1[i])
            arr2.remove(arr1[i])
        }
    }

    return result
}
/**
 * Given two arrays arr1 and arr2, find their intersection.
 *
 * @param arr1 A list containing integers
 * @param arr2 A list containing integers
 * @return A list containing the common elements between arr1 and arr2
 */
fun intersection(arr1: List<Int>, arr2: MutableList<Int>): List<Int> {
/**
 * Given two arrays arr1 and arr2, find their intersection.
 *
 * @param arr1 A list containing integers
 * @param arr2 A list containing integers
 * @return A list containing the common elements between arr1 and arr2
 */
fun intersection(arr1: List<Int>, arr2: MutableList<Int>): List<Int> {

    val result = mutableListOf<Int>()

    for (i in arr1.indices) {
        if (arr1[i] in arr2) {
            result.add(arr1[i])
            arr2.remove(arr1[i])
        }
    }

    return result
}