/**
 * This function takes a list of rock layers, represented as pairs of start and end depths,
 * and a depth on the number line. It returns a list of all rock layers that intersect with
 * the given depth.
 *
 * @param rockLayers A list of pairs representing the start and end depths of each rock layer
 * @param depth A depth value on the number line
 * @return A list of rock layers that intersect with the given depth
 */
fun findIntersection(rockLayers: List<Pair<Int, Int>>, depth: Int): List<Pair<Int, Int>> {

    val intersectingLayers = mutableListOf<Pair<Int, Int>>()

    for (layer in rockLayers) {
        val (startDepth, endDepth) = layer

        if (depth >= startDepth && depth <= endDepth) {
            intersectingLayers.add(layer)
        }
    }

    return intersectingLayers
}
/**
 * This function takes a list of rock layers, represented as pairs of start and end depths,
 * and a depth on the number line. It returns a list of all rock layers that intersect with
 * the given depth.
 *
 * @param rockLayers A list of pairs representing the start and end depths of each rock layer
 * @param depth A depth value on the number line
 * @return A list of rock layers that intersect with the given depth
 */
fun findIntersection(rockLayers: List<Pair<Int, Int>>, depth: Int): List<Pair<Int, Int>> {
/**
 * This function takes a list of rock layers, represented as pairs of start and end depths,
 * and a depth on the number line. It returns a list of all rock layers that intersect with
 * the given depth.
 *
 * @param rockLayers A list of pairs representing the start and end depths of each rock layer
 * @param depth A depth value on the number line
 * @return A list of rock layers that intersect with the given depth
 */
fun findIntersection(rockLayers: List<Pair<Int, Int>>, depth: Int): List<Pair<Int, Int>> {

    val intersectingLayers = mutableListOf<Pair<Int, Int>>()

    for (layer in rockLayers) {
        val (startDepth, endDepth) = layer

        if (depth >= startDepth && depth <= endDepth) {
            intersectingLayers.add(layer)
        }
    }

    return intersectingLayers
}