Python解法:二分

思路参考 drdr

# -*- coding:utf-8 -*-
from bisect import bisect_left 
class Solution:
    def GetNumberOfK(self, data, k):
        # write code here
        l=bisect_left(data,k-0.5)
        r=bisect_left(data,k+0.5)
        return r-l
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务