Skip to content

Commit 8ac9c00

Browse files
authored
Merge pull request neetcode-gh#1290 from zim0369/268
Create 268-Missing-Number.rs
2 parents c4c63f5 + 2386712 commit 8ac9c00

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rust/268-Missing-Number.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
impl Solution {
2+
pub fn missing_number(nums: Vec<i32>) -> i32 {
3+
let length = nums.len() as i32;
4+
let mut ans = length;
5+
for i in 0..length {
6+
ans ^= i ^ nums[i as usize];
7+
}
8+
ans
9+
}
10+
}

0 commit comments

Comments
 (0)