Rust solution
rust\nuse std::cmp::Reverse;\n\nimpl Solution {\n    pub fn max_envelopes(envelopes: Vec<Vec<i32>>) -> i32 {\n        let mut envelopes = envelopes\n           
```rust\nuse std::cmp::Reverse;\n\nimpl Solution {\n    pub fn max_envelopes(envelopes: Vec<Vec<i32>>) -> i32 {\n        let mut envelopes = envelopes\n            .iter()\n            .map(|envelope| (envelope[0], Reverse(envelope[1])))\n            .collect::<Vec<_>>();\n        envelopes.sort_unstable();\n        let mut dp = Vec::new();\n        for &(_, Reverse(h)) in &envelopes {\n            if let Some(i) = dp.binary_search(&h).err() {\n                if i < dp.len() {\n                    dp[i] = h;\n                } else {\n                    dp.push(h);\n                }\n            }\n        }\n        dp.len() as i32\n    }\n}\n```
['Rust']