[Rust] Solution using BTreeMap
Check @remember8964 for explanation\n\n# Code\nrust []\nuse rand::Rng;\nuse std::collections::BTreeMap;\n\nstruct Solution {\n    total_sum: i32,\n    mp: BTree
Check @[remember8964](https://leetcode.com/problems/random-point-in-non-overlapping-rectangles/solutions/316890/trying-to-explain-why-the-intuitive-solution-wont-work) for explanation\n\n# Code\n```rust []\nuse rand::Rng;\nuse std::collections::BTreeMap;\n\nstruct Solution {\n    total_sum: i32,\n    mp: BTreeMap<i32, Vec<i32>>,\n}\n\nimpl Solution {\n\n    fn new(rects: Vec<Vec<i32>>) -> Self {\n        let (mut total_sum, mut mp) = (0, BTreeMap::new());\n        \n        for rec in rects {\n            let (x1, y1, x2, y2) = (rec[0], rec[1], rec[2], rec[3]);\n            total_sum += (x2-x1+1)*(y2-y1+1);\n            mp.insert(total_sum, rec);\n        }\n\n        Self {total_sum, mp}\n    }\n    \n    fn pick(&self) -> Vec<i32> {\n        let mut rng = rand::thread_rng();\n        let area = rng.gen_range(0..=self.total_sum);\n        let rec = self.mp.range(area..).next().unwrap().1;\n\n        let (x1, y1, x2, y2) = (rec[0], rec[1], rec[2], rec[3]);\n\n        let x = rng.gen_range(x1..=x2);\n        let y = rng.gen_range(y1..=y2);\n\n        vec![x,y]\n    }\n}\n```
['Binary Search', 'Rust']