We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe3fb6e commit 4ee68beCopy full SHA for 4ee68be
268.Missing_Number.java
@@ -0,0 +1,10 @@
1
+class Solution {
2
+ public int missingNumber(int[] nums) {
3
+ int n = nums.length;
4
+ int sum = (n * (n+1)) / 2;
5
+ for(int i=0; i<n; i++) {
6
+ sum -= nums[i];
7
+ }
8
+ return sum;
9
10
+}
0 commit comments