/**
 * This function takes in two arrays and returns a new array containing common elements found in both arrays.
 *
 * @param array1 First input array
 * @param array2 Second input array
 * @return New array containing common elements found in both input arrays
 */
fun findCommonElements(array1: List<Any>, array2: List<Any>): List<Any> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<Any>()

    // Iterate through each element in array1
    for (element1 in array1) {
        // Iterate through each element in array2
        for (element2 in array2) {
            // Compare the current element from array1 with all elements in array2
            if (element1 == element2) {
                // If the current element is found in array2, add it to the commonElements list
                commonElements.add(element1)
            }
        }
    }

    // Return the list of common elements
    return commonElements
}
/**
 * This function takes in two arrays and returns a new array containing common elements found in both arrays.
 *
 * @param array1 First input array
 * @param array2 Second input array
 * @return New array containing common elements found in both input arrays
 */
fun findCommonElements(array1: List<Any>, array2: List<Any>): List<Any> {
/**
 * This function takes in two arrays and returns a new array containing common elements found in both arrays.
 *
 * @param array1 First input array
 * @param array2 Second input array
 * @return New array containing common elements found in both input arrays
 */
fun findCommonElements(array1: List<Any>, array2: List<Any>): List<Any> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<Any>()

    // Iterate through each element in array1
    for (element1 in array1) {
        // Iterate through each element in array2
        for (element2 in array2) {
            // Compare the current element from array1 with all elements in array2
            if (element1 == element2) {
                // If the current element is found in array2, add it to the commonElements list
                commonElements.add(element1)
            }
        }
    }

    // Return the list of common elements
    return commonElements
}