because in case of sorted arrays if nums1[i] < nums2[j] then we are certain that nums1[i] is not in nums2 so it is safe to move on to the next element in nums1 hence i += 1.
Counter will give you Counter object containing distinct elements of list as keys and count of those elements as values. c = Counter([1,2,2,1]) output: Counter({1: 2, 2: 2})
From what I can deduce from the background of your videos, you go to the office once a week the rest is remote. Hahaha. I have too much time on my hands lol. I'm sure I'm wildly off.
how do you just know what to do?
how does the sorting affects the Big O of this algo?
This can be done in O(n), without sorting.
Why are u not checking if key is there in the map or not it should raise key error right but why it is not happening
isn't the space complexity here O(n+m) as well (like the time complexity) since we have the Counter object and the output list?
No
@@pulimen thx for nothing 🤡
The word intersection threw me off for the longest time >.
Why do we need to increment i pointer in case nums[i] is smaller than nums[j] and vice -versa
because in case of sorted arrays if nums1[i] < nums2[j] then we are certain that nums1[i] is not in nums2 so it is safe to move on to the next element in nums1 hence i += 1.
What is Counter refering to?
Counter will give you Counter object containing distinct elements of list as keys and count of those elements as values.
c = Counter([1,2,2,1])
output: Counter({1: 2, 2: 2})
From what I can deduce from the background of your videos, you go to the office once a week the rest is remote. Hahaha. I have too much time on my hands lol. I'm sure I'm wildly off.
thank greats explanations