Today, I solved the Missing number.
Description:
In this question, we are asked to find missing number in nums.
Solution:
In this method, we are gonna subtract sum of nums from sum of every number of n.
For example 2:
The length of nums: 2
Range: [0, 2]
sum([0, 1, 2]) - sum([0, 1] = 2
Space Complexity: O(1)
Time Complexity: O(n)
'LeetCode ๐๏ธ > Binary' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
190. Reverse Bits (0) | 2023.05.24 |
---|---|
338. Counting Bits (0) | 2023.05.22 |
191. Number of 1 Bits (0) | 2023.05.08 |
371. Sum of Two Integers (0) | 2023.05.07 |