Skip to content

Commit 5bf2c26

Browse files
committed
feat: easy: find-target-indices-after-sorting-array.go
1 parent 05893be commit 5bf2c26

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package easy
2+
3+
import "slices"
4+
5+
func targetIndicesSort(nums []int, target int) (out []int) {
6+
slices.Sort(nums)
7+
for i := 0; i < len(nums); i++ {
8+
if nums[i] == target {
9+
out = append(out, i)
10+
}
11+
}
12+
13+
return out
14+
}

0 commit comments

Comments
 (0)