码迷,mamicode.com
首页 > 其他好文 > 详细

基础 sorted array查找最多的一个值.

时间:2014-10-07 05:19:32      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   for   sp   div   c   log   

            int pp = 1; //number of points in the same line of the point i
            if (k.size()==0){pp=0;} 
 
            for (int jj=1;jj<k.size();jj++){ //count pp
                if (k[jj]==k[jj-1]){
                    pp++;
                }else{
                    if (pp>res){res=pp}
                    pp = 1;
                }
            }
            if (pp+dup>res){res = pp+dup;}

            return res;

这种小逻辑 是黄金一般.

基础 sorted array查找最多的一个值.

标签:style   blog   color   ar   for   sp   div   c   log   

原文地址:http://www.cnblogs.com/leetcode/p/4008957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!