Skip to content

Instantly share code, notes, and snippets.

@J-Dunny
Created May 31, 2022 18:25
Show Gist options
  • Select an option

  • Save J-Dunny/ff7388a82637f117cfa101b863a01120 to your computer and use it in GitHub Desktop.

Select an option

Save J-Dunny/ff7388a82637f117cfa101b863a01120 to your computer and use it in GitHub Desktop.
Tech Challenges
Million Numbers :
What worked well in your process?
- I was able to get the code solved pretty fast in about 20 min. But I believe that this would be O(n^2).
What was difficult/where did you struggle?
- I would struggle on making this more efficient
What feedback/discussion did you have with your peer?
-
Is there anything you want to change about your approach to the next technical challenge?
-
function findMatches(nums1, nums2, nums3){
let duplicates = []
for(let i in nums1){
if(nums2.includes(nums1[i]) && nums3.includes(nums1[i])){
duplicates.push(nums1[i])
}
}
return duplicates
}
const nums1 = [1, 2, 4, 5, 8]
const nums2 = [2, 3, 5, 7, 9]
const nums3 = [1, 2, 5, 8, 9]
console.log(findMatches(nums1, nums2, nums3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment