/**
 * Given two lists, find the common elements between them using identity comparison.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the common elements.
 *
 * Example:
 * val list1 = listOf(1, 2, 3, 4, 5)
 * val list2 = listOf(5, 6, 7, 8, 9)
 *
 * findCommonElements(list1, list2) -> [5]
 *
 * Note:
 * - This function should only consider the elements that are present in both lists.
 * - The order of the elements in the returned list is not important.
 * - If there are no common elements, an empty list should be returned.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    for (element in list1) {
        if (element in list2 && element === element) {  // Identity comparison using "===" operator
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Given two lists, find the common elements between them using identity comparison.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the common elements.
 *
 * Example:
 * val list1 = listOf(1, 2, 3, 4, 5)
 * val list2 = listOf(5, 6, 7, 8, 9)
 *
 * findCommonElements(list1, list2) -> [5]
 *
 * Note:
 * - This function should only consider the elements that are present in both lists.
 * - The order of the elements in the returned list is not important.
 * - If there are no common elements, an empty list should be returned.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, find the common elements between them using identity comparison.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the common elements.
 *
 * Example:
 * val list1 = listOf(1, 2, 3, 4, 5)
 * val list2 = listOf(5, 6, 7, 8, 9)
 *
 * findCommonElements(list1, list2) -> [5]
 *
 * Note:
 * - This function should only consider the elements that are present in both lists.
 * - The order of the elements in the returned list is not important.
 * - If there are no common elements, an empty list should be returned.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    for (element in list1) {
        if (element in list2 && element === element) {  // Identity comparison using "===" operator
            commonElements.add(element)
        }
    }

    return commonElements
}