首页 > 其他 > 详细

(Easy) Height Checker LeetCode

时间:2019-07-31 16:28:37      阅读:109      评论:0      收藏:0      [点我收藏+]
class Solution {
    public int heightChecker(int[] heights) {
        
        int [] tmp = heights.clone();
        
        Arrays.sort(tmp);
        
        int result = 0;
        for(int i = 0; i< heights.length; i++){
            
            if(heights[i]!= tmp[i]){
                result ++;
            }
            
        }
        
        return result;
        
    }
}

 

(Easy) Height Checker LeetCode

原文:https://www.cnblogs.com/codingyangmao/p/11277008.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!