解题思路 解题思路 class Solution { public int missingNumber(int[] nums) { int expectedSum = nums.length*(nums.length + 1)/2; int actualSum = 0; for (int num : nums) actualSum += num; return expectedSum - actualSum; }}