Super easy python solution


  • 0
    N
    class Solution(object):
        def searchRange(self, nums, target):
            """
            :type nums: List[int]
            :type target: int
            :rtype: List[int]
            """
            nums.append(target+1)
            start, end = -1, -1
            for x in xrange(len(nums)):
                if start == -1 and nums[x] == target:
                    start = x
                if start != -1 and nums[x] == target:
                    end = x
            return [start, end]
    

Log in to reply
 

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