We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9c069e commit 0a5d727Copy full SHA for 0a5d727
2032-two-out-of-three.js
@@ -0,0 +1,32 @@
1
+/**
2
+ * @param {number[]} nums1
3
+ * @param {number[]} nums2
4
+ * @param {number[]} nums3
5
+ * @return {number[]}
6
+ */
7
+const twoOutOfThree = function(nums1, nums2, nums3) {
8
+ const res = []
9
+ const hash = {}
10
+ for(let e of new Set(nums1)) {
11
+ if(hash[e] == null) hash[e] = 0
12
+ hash[e] = 1
13
+ }
14
+
15
+ for(let e of new Set(nums2)) {
16
17
+ hash[e]++
18
19
20
21
+ for(let e of new Set(nums3)) {
22
23
24
25
26
+ Object.keys(hash).forEach(k => {
27
+ if(hash[k] > 1) res.push(k)
28
+ })
29
30
31
+ return res
32
+};
0 commit comments