summaryrefslogtreecommitdiff
path: root/find-the-difference-of-two-arrays/src/main.rs
blob: a09cecb1e7791b808dd34ee1eceaf8f65eded852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
fn main() {
    println!("Hello, world!");
}

struct Solution {}
impl Solution {
    pub fn find_difference(nums1: Vec<i32>, nums2: Vec<i32>) -> Vec<Vec<i32>> {
        let mut a: Vec<i32> = Vec::new();
        let mut b: Vec<i32> = Vec::new();

        for i in nums1 {
            if !nums2.contains(&i) && !nums1.contains(&i) {
                a.push(i);
            }
        }
        for i in nums2 {
            if !nums2.contains(&i) && !nums1.contains(&i) {
                b.push(i);
            }
        }

        vec![a,b]

    }
}