首页 > 其他 > 详细

Leetcode1051Height Checker

时间:2020-01-20 10:04:28      阅读:80      评论:0      收藏:0      [点我收藏+]

public int heightChecker(int[] heights) {
int [] Heights=heights.clone();
int count=0; //标记有几个不同
Arrays.sort(heights);
for(int i=0;i<heights.length;i++) {
if (Heights[i] != heights[i]) {
count++;
}
}
System.out.println(count);
return count;
}

前后用的冒泡和快排时间复杂度竟然一样

这里mark一下没搞懂

Leetcode1051Height Checker

原文:https://www.cnblogs.com/chengxian/p/12216199.html

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