image_2021-11-29_17-37-18.png
29.5 KB
#N2089. Find Target Indices After Sorting Array
problem link
#solution
problem link
#solution
class Solution {
public List<Integer> targetIndices(int[] nums, int target) {
Arrays.sort(nums);
List<Integer> list = new ArrayList<>();
for(int i=0; i<nums.length; i++)
if(nums[i]==target) list.add(i);
return list;
}
}