You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.
What if the given array is already sorted? How would you optimize your algorithm?
Using map built-in data structure in Javascript
What if nums1's size is small compared to nums2's size? Which algorithm is better?
in second for loop, we can check if the map has a frequence larger than 0, if larger than 0 it means first loop has more
specific number than in the second loop.
What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the
memory at once?
Split the numeric range into subranges that fits into the memory. Modify code to collect counts only within a given subrange, and call the method multiple times (for each subrange).
The text was updated successfully, but these errors were encountered:
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.
specific number than in the second loop.
memory at once?
The text was updated successfully, but these errors were encountered: