Thank you. I have always wondered why there was a pre-increment and a post increment, and this is a perfect use case for post-increment. It's the small things sometimes. I've never seen that before.
I had it so close.... I was increasing the indexes depending on nums1 and nums2 sizes... that approach worked for a few testcases but I couldn't figure out until saw this video, thanks! For sure I was not able to solve it by myself but still learned a lot :)
@@xavierelon I don't usually pay much attention to intros and for me, the best intro is the one I barely notice and I didn't notice yours. Don't get me wrong, I don't mean it in a bad way, on the contrary , I think it's visually great, not irritating like in some channels, and most importantly - short, but people usually come for the content and not for the intros.
Great explanation. Just wasn't clear to me why SC is O(logm + long). Is it due to the sort of arrays generates overrides the initial value of nums array or why? Thanks in advance.
Am I missing anything, I feel this algorithm is not working. A=[1,2,2,1,3,2] B=[1,2,3] A_sorted=[1,1,2,2,2,3] expected output: [1,2] The Algorithm will produce[1,2,3]
Thank you!!! Finally, this was the first explanation I was actually able to understand.
Me too
Thank you. I have always wondered why there was a pre-increment and a post increment, and this is a perfect use case for post-increment. It's the small things sometimes. I've never seen that before.
Hey. The solution doesn't work for : int[] arr1 = {4,9,5};
int[] arr2 = {9,4,9,8,4}; please check.
At max, minimum of size of both arrays can be duplicates, so instead of doing length1 * length2, you can do min(length1, length2)
Very nice explanation thankyou 🙏🏼🙏🏼🙏🏼
Finally an explanation using constant space!
I had it so close.... I was increasing the indexes depending on nums1 and nums2 sizes... that approach worked for a few testcases but I couldn't figure out until saw this video, thanks! For sure I was not able to solve it by myself but still learned a lot :)
Keep up the good work! You're doing great.
Great video, you definitely deserve more subs, one note: that music started waaaayyy too early and was kinda unexpected covering your voice over.
Thanks man. And thanks for the critique I'll be sure to fix it. What do you think about my intro I made? I'm still working on it
@@xavierelon I don't usually pay much attention to intros and for me, the best intro is the one I barely notice and I didn't notice yours. Don't get me wrong, I don't mean it in a bad way, on the contrary
, I think it's visually great, not irritating like in some channels, and most importantly - short, but people usually come for the content and not for the intros.
Serdar Asgarov awesome thank you for the constructive criticism. Make sure you subscribe if you haven’t already hehe
@@xavierelon Hey , can you show us how you made your intro bcoz its cool or is it a purchased plugin?
nice and understandable!! TY
Solution without using extra space is amazing thanks! Bit time complexity basically is O(N), isn't it?
Yes should be. Did I forget to mention time complexity in this video? Sorry if so
Wouldn't it be O(nlogn) because that's the time complexity of Arrays.sort()?
@@vikasraaja5760 lgta h timeComplexity india m jada matter krti h
@@yogeshyts of course, har company ke coding round mein aata hai ye sab
Great explanation. Just wasn't clear to me why SC is O(logm + long). Is it due to the sort of arrays generates overrides the initial value of nums array or why? Thanks in advance.
waw its really simple and awesome
I am little confused about the third array(ans) size as length1 * length2. Can we take the size as the smallest of length1 and length2?
Oops ! sorry. I commented before I finished this video...
wait i still don't get it why
What about the values which are already present in nums1 how are they getting deleted
how to implement the same in c++ with same space com.
i tried but more elements are getting copied can you give code for same. thanks for video
why did we use nums1 and not nums2 to store the common elements
where are you getting the nums in return Arrays.copyOfRange(nums, 0, k);
It’s nums1
How is the space *O(log m + log n)* ?
Am I missing anything, I feel this algorithm is not working.
A=[1,2,2,1,3,2]
B=[1,2,3]
A_sorted=[1,1,2,2,2,3]
expected output: [1,2]
The Algorithm will produce[1,2,3]
expected output is actually 1,2,3...d problem is to find intersection, similar-distinct elements in both array
Which software do you use as a whiteboard??
thanks
Goodnotes on my ipad
@@xavierelon thanks ❤️
could have optimized to O(mlogm + n)
So smart to add background music while you're unable to articulate well the n/m complexity. I've broken my ears