[Rust] With BinaryHeap
rust\nuse std::cmp::{Ordering, Reverse};\nuse std::collections::BinaryHeap;\n\n#[derive(Eq, PartialEq)]\nstruct NumStr(String);\n\nimpl Ord for NumStr {\n    fn
```rust\nuse std::cmp::{Ordering, Reverse};\nuse std::collections::BinaryHeap;\n\n#[derive(Eq, PartialEq)]\nstruct NumStr(String);\n\nimpl Ord for NumStr {\n    fn cmp(&self, other: &Self) -> Ordering {\n        match self.0.len().cmp(&other.0.len()) {\n            Ordering::Less => Ordering::Less,\n            Ordering::Greater => Ordering::Greater,\n            Ordering::Equal => self.0.cmp(&other.0),\n        }\n    }\n}\n\nimpl PartialOrd for NumStr {\n    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {\n        Some(self.cmp(other))\n    }\n}\n\npub fn kth_largest_number(nums: Vec<String>, k: i32) -> String {\n    let mut pq = BinaryHeap::with_capacity(k as usize);\n\n    for n in nums.into_iter() {\n        let ns = NumStr(n);\n\n        if (k as usize) > pq.len() {\n            pq.push(Reverse(ns));\n        } else {\n            if let Some(Reverse(smallest)) = pq.peek() {\n                if &ns > smallest {\n                    pq.pop();\n                    pq.push(Reverse(ns));\n                }\n            }\n        }\n    }\n\n    pq.pop().unwrap().0 .0\n}\n```
['Heap (Priority Queue)', 'Rust']