Rust solution with sort
\nimpl Solution {\n    pub fn max_subsequence(nums: Vec<i32>, k: i32) -> Vec<i32> {\n        if k == nums.len() as i32 || nums.len() == 1 {\n            return 
```\nimpl Solution {\n    pub fn max_subsequence(nums: Vec<i32>, k: i32) -> Vec<i32> {\n        if k == nums.len() as i32 || nums.len() == 1 {\n            return nums;\n        }\n\n        let mut num_idx = nums.iter().enumerate().collect::<Vec<_>>();\n        num_idx.sort_unstable_by_key(|(_, x)| **x);\n\n        let mut idx = vec![false; nums.len()];\n        num_idx\n            .into_iter()\n            .rev()\n            .take(k as usize)\n            .for_each(|(i, _)| idx[i] = true);\n\n        nums.into_iter()\n            .enumerate()\n            .filter_map(|(i, x)| if idx[i] { Some(x) } else { None })\n            .collect()\n    }\n}\n```
['Rust']