Clear python code


  • -2
    J
    class Solution(object):
    def searchRange(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """
        res=[]
        re=[]
        for i,j in enumerate(nums):
            if j==target:
                res.append(i)
        if not res:
            re= [-1,-1]
        if res:
            re=[res[0],res[-1]]
        return re

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.