Skip to content

Commit

Permalink
Create 268-Missing-Number.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
zim0369 committed Oct 20, 2022
1 parent 939af48 commit 2386712
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rust/268-Missing-Number.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
impl Solution {
pub fn missing_number(nums: Vec<i32>) -> i32 {
let length = nums.len() as i32;
let mut ans = length;
for i in 0..length {
ans ^= i ^ nums[i as usize];
}
ans
}
}

0 comments on commit 2386712

Please sign in to comment.