본문 바로가기
python-algorithm

leetcode 2089. Find Target Indices After Sorting Array

by 무적김두칠 2022. 3. 15.

1
2
3
4
5
6
7
8
class Solution:
    def targetIndices(self, nums: List[int], target: int-> List[int]:
        ans=[]
        nums.sort()
        for i in  range(len(nums)):
            if target==nums[i]: ans.append(i)
            #if target<i: break
        return ans
cs
반응형

댓글