pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
    let (width, height) = match (input.len(), input[0].len()) {
        (0, _) | (_, 0) => return Vec::new(),
        (n, k) => (n, k),
    };

    let mut saddle_points = Vec::new();

    for i in 0..width {
        let row_max = input[i].iter().max().unwrap();

        for j in 0..height {
            let column_min = input.iter().map(|x| x[j]).min().unwrap();

            let value = input[i][j];

            if value == *row_max && value == column_min {
                saddle_points.push((i, j));
            }
        }
    }

    saddle_points
}

pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
    let height = if !input.is_empty() && !input[0].is_empty() {
        input[0].len()
    } else {
        return Vec::new();
    };

    let mut saddle_points = Vec::new();

    let col_mins: Vec<u64> = (0..height)
        .filter_map(|j| input.iter().map(|row| row[j]).min())
        .collect();

    for (i, row) in input.iter().enumerate() {
        let row_max = *row.iter().max().unwrap();

        for j in 0..height {
            if row[j] == row_max && row[j] == col_mins[j] {
                saddle_points.push((i, j));
            }
        }
    }

    saddle_points
}

Improve based on the given feedback
Improve based on the given feedback
