Maximum Length of Pair Chain LeetCode solution in Rust
1impl Solution {2pub fn find_longest_chain(mut pairs: Vec<Vec<i32>>) -> i32 {3// sort by second element of the pair4pairs.sort_by(|a, b| a[1].cmp(&b[1]));56// count the number of pairs that dont overlap7let mut count = 1;8let mut prev = pairs[0][1];9for i in 1..pairs.len() {10if pairs[i][0] > prev {11count += 1;12prev = pairs[i][1];13}14}1516count17}18}