/**
 * Given two lists of integers, find the common elements between them using range function short-circuiting.
 */
fun findCommonElementsRange(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (i in list1.indices) {
        var found = false
        for (j in list2.indices) {
            if (list1[i] == list2[j]) {
                commonElements.add(list1[i])
                found = true
                break
            }
        }
        if (found) {
            break
        }
    }

    return commonElements
}
/**
 * Given two lists of integers, find the common elements between them using range function short-circuiting.
 */
fun findCommonElementsRange(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists of integers, find the common elements between them using range function short-circuiting.
 */
fun findCommonElementsRange(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (i in list1.indices) {
        var found = false
        for (j in list2.indices) {
            if (list1[i] == list2[j]) {
                commonElements.add(list1[i])
                found = true
                break
            }
        }
        if (found) {
            break
        }
    }

    return commonElements
}