Skip to content

Commit 247055c

Browse files
authored
268. Missing Number
1 parent 25c1974 commit 247055c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

268. Missing Number.kt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution {
2+
fun missingNumber(nums: IntArray): Int {
3+
val n = nums.size
4+
val expextedSum = n*(n+1)/2
5+
val actualSum = nums.sum()
6+
return expextedSum - actualSum
7+
}
8+
}

0 commit comments

Comments
 (0)