题目说明:
统计一个数字在排序数组中出现的次数。
示例 1:
输入: nums= [5,7,7,8,8,10],target=8
输出: 2
思路:直接使用count函数即可
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
return nums.count(target)