We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 135c4b7 commit 72de6f1Copy full SHA for 72de6f1
2089/main.rs
@@ -0,0 +1,11 @@
1
+impl Solution {
2
+ pub fn target_indices(nums: Vec<i32>, target: i32) -> Vec<i32> {
3
+ let mut nums = nums;
4
+ nums.sort();
5
+ nums.iter()
6
+ .enumerate()
7
+ .filter(|(_, &x)| x == target)
8
+ .map(|(x, _)| x as i32)
9
+ .collect::<Vec<_>>()
10
+ }
11
+}
0 commit comments