统计一个数字在排序数组中出现的次数。
示例 1:
输入: nums = [5,7,7,8,8,10], target = 8 输出: 2
class Solution:
def search(self, nums: List[int], target: int) -> int:
count=collections.Counter(nums)
return count[target]
统计一个数字在排序数组中出现的次数。
示例 1:
输入: nums = [5,7,7,8,8,10], target = 8 输出: 2
class Solution:
def search(self, nums: List[int], target: int) -> int:
count=collections.Counter(nums)
return count[target]