Rust O(m+n) solution
rust\nimpl Solution {\n    pub fn search_matrix(matrix: Vec<Vec<i32>>, target: i32) -> bool {\n        let (mut i, mut j) = (0, matrix[0].len() - 1);\n        w
```rust\nimpl Solution {\n    pub fn search_matrix(matrix: Vec<Vec<i32>>, target: i32) -> bool {\n        let (mut i, mut j) = (0, matrix[0].len() - 1);\n        while i < matrix.len() {\n            match matrix[i][j].cmp(&target) {\n                std::cmp::Ordering::Less => i += 1,\n                std::cmp::Ordering::Equal => return true,\n                std::cmp::Ordering::Greater if j > 0 => j -= 1,\n                std::cmp::Ordering::Greater => break,\n            }\n        }\n        false\n    }\n}\n```
['Rust']