Minimum Common Value | 3 Approaches | Leetcode 2540
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 26th Video of our Playlist "Leetcode Easy : Popular Interview Problems".
In this video we will try to solve a very good practice problem : Minimum Common Value | 3 Approaches | Leetcode 2540
Share your learnings on LinkedIn, Twitter (X), Instagram, Facebook(Meta) with
hashtag #codestorywithmik & feel free to tag me.
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY. We will do live coding after explanation and see if we are able to pass all the test cases.
Problem Name : Minimum Common Value | 3 Approaches | Leetcode 2540
Company Tags : Microsoft
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Arrays/Leetcode%20Easy/Minimum%20Common%20Value.cpp
Leetcode Link : https://leetcode.com/problems/minimum-common-value/
My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Zduesi8&list=PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Approach Summary :
1. Approach-1 (Using Set):
- Time Complexity (T.C): O(m + n), where m and n are the sizes of the input arrays.
- Space Complexity (S.C): O(m).
- The approach uses a set to store elements from the first array, and then iterates through the second array to find the common element.
2. Approach-2 (Using Binary Search):
- Time Complexity (T.C): O(m log n), where m and n are the sizes of the input arrays.
- Space Complexity (S.C): O(1).
- The approach employs binary search on the second array for each element in the first array to find the common element.
3. Approach-3 (Using 2 Pointers):
- Time Complexity (T.C): O(m + n), where m and n are the sizes of the input arrays.
- Space Complexity (S.C): O(1).
- Two pointers are used to iterate through both arrays simultaneously, comparing elements to find the common element efficiently.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
01:30 - Approach-1
03:39 - Approach-2
05:29 - Approach-3
07:41 - Coding all up
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear