题目描述

 

 

 

 

public class Solution {
    public int GetNumberOfK(int [] array , int k) {
       int count = 0;
       for(int i =0;i < array.length;i++){
           if(k == array[i]){
               count++;
               continue;
           }
           if(count !=0){
               break;
           }
       }
       return count;
    }
}

 

posted on 2020-06-09 03:04  MoonBeautiful  阅读(52)  评论(0编辑  收藏  举报