1150. Check If a Number Is Majority Element in a Sorted Array
Содержание
class Solution:
def isMajorityElement(self, nums: List[int], target: int) -> bool:
left = bisect_left(nums, target)
right = left + len(nums) // 2
return right < len(nums) and nums[right] == target