Skip to content

Commit d9f2cc3

Browse files
authored
missing number solution with complexities
1 parent 49b6585 commit d9f2cc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

missing-number/yhkee0404.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object Solution {
22
def missingNumber(nums: Array[Int]): Int = {
3-
(1 to nums.length).reduce(_ ^ _) ^ nums.reduce(_ ^ _)
3+
(1 to nums.length).reduce(_ ^ _) ^ nums.reduce(_ ^ _) // T(n) = O(n), S(n) = O(1)
44
}
55
}

0 commit comments

Comments
 (0)