/**
 * Return the intersection between two ranges with negative values.
 *
 * @param a The first range
 * @param b The second range
 * @return A list containing the intersection between the two ranges
 *
 * Example:
 * findIntersection(-5..0, -3..1) // Output: [-3, -2, -1, 0]
 * findIntersection(-10 downTo -2, -6 downTo 0) // Output: [-10, -9, -8, -7, -6]
 */
fun findIntersection(a: IntRange, b: IntRange): List<Int> {

    // Initialize an empty list to store the intersection
    val intersection = mutableListOf<Int>()
    
    // Iterate over each element in the first range
    for (i in a) {
        // Iterate over each element in the second range
        for (j in b) {
            // Check if the element from the first range is equal to the element from the second range
            if (i == j) {
                // Add the element to the intersection list
                intersection.add(i)
            }
        }
    }
    
    // Return the intersection
    return intersection
}
/**
 * Return the intersection between two ranges with negative values.
 *
 * @param a The first range
 * @param b The second range
 * @return A list containing the intersection between the two ranges
 *
 * Example:
 * findIntersection(-5..0, -3..1) // Output: [-3, -2, -1, 0]
 * findIntersection(-10 downTo -2, -6 downTo 0) // Output: [-10, -9, -8, -7, -6]
 */
fun findIntersection(a: IntRange, b: IntRange): List<Int> {
/**
 * Return the intersection between two ranges with negative values.
 *
 * @param a The first range
 * @param b The second range
 * @return A list containing the intersection between the two ranges
 *
 * Example:
 * findIntersection(-5..0, -3..1) // Output: [-3, -2, -1, 0]
 * findIntersection(-10 downTo -2, -6 downTo 0) // Output: [-10, -9, -8, -7, -6]
 */
fun findIntersection(a: IntRange, b: IntRange): List<Int> {

    // Initialize an empty list to store the intersection
    val intersection = mutableListOf<Int>()
    
    // Iterate over each element in the first range
    for (i in a) {
        // Iterate over each element in the second range
        for (j in b) {
            // Check if the element from the first range is equal to the element from the second range
            if (i == j) {
                // Add the element to the intersection list
                intersection.add(i)
            }
        }
    }
    
    // Return the intersection
    return intersection
}