(Easy) Height Checker LeetCode
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; } }

浙公网安备 33010602011771号