[] To prove safety Offer number 37. The number that appears in the sorted array in python achieve

Title describes
the number of times a statistical number that appears in the sort array.

# -*- coding:utf-8 -*-
class Solution:
    def GetNumberOfK(self, data, k):
        # write code here
        count = 0
        for i in data:
            if k == i:
                count += 1
        return count
Published 99 original articles · won praise 6 · views 3958

Guess you like

Origin blog.csdn.net/weixin_42247922/article/details/104021419