/**
 * This function finds the intersection of two arrays using a basic for loop and selection logic.
 * It returns a list of common elements between the two input arrays.
 *
 * @param arr1 A list (array) of elements
 * @param arr2 A list (array) of elements
 * @return List of common elements between arr1 and arr2
 */
fun intersectionOfSelectionAndBasicForLoop(arr1: List<Any>, arr2: List<Any>): List<Any> {

    val intersection = mutableListOf<Any>()

    // Iterate over each element in arr1
    for (elem1 in arr1) {
        // Iterate over each element in arr2
        for (elem2 in arr2) {
            // Check if the current element from arr1 is equal to any element in arr2
            if (elem1 == elem2) {
                // Check if the element is already in the intersection list
                if (elem1 !in intersection) {
                    // Add the element to the intersection list
                    intersection.add(elem1)
                }
                // Break the inner loop as we found a common element
                break
            }
        }
    }

    return intersection
}
/**
 * This function finds the intersection of two arrays using a basic for loop and selection logic.
 * It returns a list of common elements between the two input arrays.
 *
 * @param arr1 A list (array) of elements
 * @param arr2 A list (array) of elements
 * @return List of common elements between arr1 and arr2
 */
fun intersectionOfSelectionAndBasicForLoop(arr1: List<Any>, arr2: List<Any>): List<Any> {
/**
 * This function finds the intersection of two arrays using a basic for loop and selection logic.
 * It returns a list of common elements between the two input arrays.
 *
 * @param arr1 A list (array) of elements
 * @param arr2 A list (array) of elements
 * @return List of common elements between arr1 and arr2
 */
fun intersectionOfSelectionAndBasicForLoop(arr1: List<Any>, arr2: List<Any>): List<Any> {

    val intersection = mutableListOf<Any>()

    // Iterate over each element in arr1
    for (elem1 in arr1) {
        // Iterate over each element in arr2
        for (elem2 in arr2) {
            // Check if the current element from arr1 is equal to any element in arr2
            if (elem1 == elem2) {
                // Check if the element is already in the intersection list
                if (elem1 !in intersection) {
                    // Add the element to the intersection list
                    intersection.add(elem1)
                }
                // Break the inner loop as we found a common element
                break
            }
        }
    }

    return intersection
}