/**
 * This function finds the intersection of two lists using short-circuiting.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return Intersection of the two lists
 */
fun intersection(list1: List<Any>, list2: List<Any>): List<Any> {

    val result = mutableListOf<Any>()

    for (element1 in list1) {
        for (element2 in list2) {
            if (element1 == element2) {
                result.add(element1)
                break  // Short-circuiting here
            }
        }
    }

    return result
}
/**
 * This function finds the intersection of two lists using short-circuiting.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return Intersection of the two lists
 */
fun intersection(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This function finds the intersection of two lists using short-circuiting.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return Intersection of the two lists
 */
fun intersection(list1: List<Any>, list2: List<Any>): List<Any> {

    val result = mutableListOf<Any>()

    for (element1 in list1) {
        for (element2 in list2) {
            if (element1 == element2) {
                result.add(element1)
                break  // Short-circuiting here
            }
        }
    }

    return result
}