2025-08-17 09:55:05 +0000 UTC
Find Target Indices After Sorting Array
Categories:
Links
Code
class Solution:
def targetIndices(self, nums: List[int], target: int) -> List[int]:
count_eq = 0
count_less = 0
for num in nums:
if num == target:
count_eq += 1
elif num < target:
count_less += 1
return tuple(range(count_less, count_less + count_eq))