/**
 * Given a 2D list of elevations and the number of rows and columns,
 * find the minimum elevation in the specified range.
 *
 * @param elevations A 2D list of elevations.
 * @param rows The number of rows in the 2D list.
 * @param cols The number of columns in the 2D list.
 * @return The minimum elevation.
 * @throws IllegalArgumentException If the provided range exceeds the dimensions of the elevations list.
 */
fun findMinElevation(elevations: Array<FloatArray>, rows: Int, cols: Int): Float {

    var minElevation = Float.POSITIVE_INFINITY

    // Iterating over each row
    for (row in 0 until rows) {
        // Iterating over each column
        for (col in 0 until cols) {
            // Finding the minimum elevation
            if (elevations[row][col] < minElevation) {
                minElevation = elevations[row][col]
            }
        }
    }

    return minElevation
}
/**
 * Given a 2D list of elevations and the number of rows and columns,
 * find the minimum elevation in the specified range.
 *
 * @param elevations A 2D list of elevations.
 * @param rows The number of rows in the 2D list.
 * @param cols The number of columns in the 2D list.
 * @return The minimum elevation.
 * @throws IllegalArgumentException If the provided range exceeds the dimensions of the elevations list.
 */
fun findMinElevation(elevations: Array<FloatArray>, rows: Int, cols: Int): Float {
/**
 * Given a 2D list of elevations and the number of rows and columns,
 * find the minimum elevation in the specified range.
 *
 * @param elevations A 2D list of elevations.
 * @param rows The number of rows in the 2D list.
 * @param cols The number of columns in the 2D list.
 * @return The minimum elevation.
 * @throws IllegalArgumentException If the provided range exceeds the dimensions of the elevations list.
 */
fun findMinElevation(elevations: Array<FloatArray>, rows: Int, cols: Int): Float {

    var minElevation = Float.POSITIVE_INFINITY

    // Iterating over each row
    for (row in 0 until rows) {
        // Iterating over each column
        for (col in 0 until cols) {
            // Finding the minimum elevation
            if (elevations[row][col] < minElevation) {
                minElevation = elevations[row][col]
            }
        }
    }

    return minElevation
}