python 2 lines


  • 0
    from bisect import *
    def searchRange(self, nums, target):
        left = bisect_left(nums, target)
        return [-1, -1] \
        if left >= len(nums) or nums[left] != target \
        else [left, bisect_right(nums, target) - 1]

Log in to reply
 

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