1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Find Target Indices After Sorting Array (LeetCode 2089)
Indices of target after sorting.
## Approach
```python
def targetIndices(nums, target):
nums.sort()
return [i for i,x in enumerate(nums) if x==target]
```
## Complexity
- Time / space depend on the scan above; keep the solution linear when possible.
## Interview tip
Narrate the invariant before coding. I drill these patterns with [AI assistant for technical interviews](https://www.linkjob.ai/coding-interview-copilot/) ahead of OA rounds.
*Disclosure: I work on Linkjob AI, an interview copilot. The algorithm above stands on its own.*
|