/**
 * Given two lists representing ranges on the number line, this function finds the intersection between them.
 *
 * @param range1 a list representing the first range
 * @param range2 a list representing the second range
 * @return a list containing the common elements between the two ranges, represented on the number line
 */
fun findCommonElements(range1: List<Int>, range2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (num1 in range1) {
        for (num2 in range2) {
            if (num1 <= num2 && num2 <= num1 + 1) {
                commonElements.add(num2)
            }
        }
    }
    return commonElements
}
/**
 * Given two lists representing ranges on the number line, this function finds the intersection between them.
 *
 * @param range1 a list representing the first range
 * @param range2 a list representing the second range
 * @return a list containing the common elements between the two ranges, represented on the number line
 */
fun findCommonElements(range1: List<Int>, range2: List<Int>): List<Int> {
/**
 * Given two lists representing ranges on the number line, this function finds the intersection between them.
 *
 * @param range1 a list representing the first range
 * @param range2 a list representing the second range
 * @return a list containing the common elements between the two ranges, represented on the number line
 */
fun findCommonElements(range1: List<Int>, range2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (num1 in range1) {
        for (num2 in range2) {
            if (num1 <= num2 && num2 <= num1 + 1) {
                commonElements.add(num2)
            }
        }
    }
    return commonElements
}