/**
 * Given two lists of depths and temperatures, this function determines the intersection points
 * where the temperature exceeds a certain threshold and appends them to a new list.
 *
 * @param depths a list of depths in meters
 * @param temperatures a list of corresponding temperatures in degrees Celsius
 * @return intersectionPoints a list of pairs containing depths and temperatures where the threshold is exceeded
 */
fun calculateIntersection(depths: List<Double>, temperatures: List<Double>): List<Pair<Double, Double>> {

    // Initialize an empty list to store the intersection points
    val intersectionPoints = mutableListOf<Pair<Double, Double>>()

    // Set the threshold temperature in degrees Celsius
    val thresholdTemperature = 50.0

    // Use a while loop to iterate through the depths and temperatures simultaneously
    var index = 0
    while (index < depths.size && index < temperatures.size) {
        // Check if the temperature at the current depth exceeds the threshold
        if (temperatures[index] > thresholdTemperature) {
            // Append the depth and temperature as a pair to the intersectionPoints list
            intersectionPoints.add(depths[index] to temperatures[index])
        }
        // Increment the index by 1 to move to the next depth and temperature values
        index++
    }

    return intersectionPoints
}
/**
 * Given two lists of depths and temperatures, this function determines the intersection points
 * where the temperature exceeds a certain threshold and appends them to a new list.
 *
 * @param depths a list of depths in meters
 * @param temperatures a list of corresponding temperatures in degrees Celsius
 * @return intersectionPoints a list of pairs containing depths and temperatures where the threshold is exceeded
 */
fun calculateIntersection(depths: List<Double>, temperatures: List<Double>): List<Pair<Double, Double>> {
/**
 * Given two lists of depths and temperatures, this function determines the intersection points
 * where the temperature exceeds a certain threshold and appends them to a new list.
 *
 * @param depths a list of depths in meters
 * @param temperatures a list of corresponding temperatures in degrees Celsius
 * @return intersectionPoints a list of pairs containing depths and temperatures where the threshold is exceeded
 */
fun calculateIntersection(depths: List<Double>, temperatures: List<Double>): List<Pair<Double, Double>> {

    // Initialize an empty list to store the intersection points
    val intersectionPoints = mutableListOf<Pair<Double, Double>>()

    // Set the threshold temperature in degrees Celsius
    val thresholdTemperature = 50.0

    // Use a while loop to iterate through the depths and temperatures simultaneously
    var index = 0
    while (index < depths.size && index < temperatures.size) {
        // Check if the temperature at the current depth exceeds the threshold
        if (temperatures[index] > thresholdTemperature) {
            // Append the depth and temperature as a pair to the intersectionPoints list
            intersectionPoints.add(depths[index] to temperatures[index])
        }
        // Increment the index by 1 to move to the next depth and temperature values
        index++
    }

    return intersectionPoints
}