summaryrefslogtreecommitdiff
path: root/find-the-difference-of-two-arrays/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'find-the-difference-of-two-arrays/src/main.rs')
-rw-r--r--find-the-difference-of-two-arrays/src/main.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/find-the-difference-of-two-arrays/src/main.rs b/find-the-difference-of-two-arrays/src/main.rs
new file mode 100644
index 0000000..a09cecb
--- /dev/null
+++ b/find-the-difference-of-two-arrays/src/main.rs
@@ -0,0 +1,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]
+
+ }
+}