Merge Sorted Array || Leetcode 88 || 1 Variant Question Big Tech Actually Asks

preview_player
Показать описание
Discover the actual variant Meta asks on Leetcode problem 88: Merge Sorted Array.

Timestamps:
00:00 Leetcode Explanation
06:01 Leetcode Coding
07:05 Variant Explanation (Without M & N)
10:06 Variant Coding: (Without M & N)

Follow us on social media:

GitHub:

More Context:
FAANG, mid-sized companies, and startups are asking more LeetCode-style puzzle questions every day, making it harder to stand out as the competition grows. With an increasing number of new graduates entering the software market and tech companies laying off developers while overworking those who remain, it’s a tough landscape. Take Meta, for example: they expect 2-3 months of intense study time, only to likely ghost you afterward. But this doesn’t mean we should be unprepared.

While LeetCode is a valuable learning resource, many developers focus too much on rote memorization. Others find themselves stuck in a vicious cycle, where they don’t study as efficiently as they could because they’re juggling multiple responsibilities. They have full-time jobs, personal commitments, or other obligations that limit the time they can dedicate to solving problems. It’s a grind. Unfortunately, most companies introduce their own twists or "variants" of common problems (e.g., 6-sum instead of 2-sum), which throw candidates off. Rephrasings of problems and follow-up questions are also common, so recognizing these variations and curveballs is crucial.

For those who don’t have the time to revisit LeetCode problems multiple times to solidify concepts, this channel covers the most frequently asked variants, rephrasings, and follow-ups. If you've seen these before, you’ll have a significant edge over your competitors. Remember, time pressure — especially at Meta — is intense, so speed is essential. Even with thorough preparation, interviewers may be unpredictable, but knowing the variants beforehand can drastically increase your chances of success.

Take LeetCode 88, Merge Sorted Array, which is one of Meta’s most frequently asked questions (top 10 as of writing). Meta rarely sticks with the original problem. Variants - however - do exist, and with thousands of interviewers, it's hard to predict them all. We cover a key variant: what if you’re not given integers M or N? Instead, we’re guaranteed that one list is double the size of the other.

We also walk through variants in mock interviews. Using the exact platform (CoderPad) that Meta uses, you’ll get familiar with the UI, settings, and overall experience. This is a 1-on-1 simulation of how Meta conducts and facilitates their interviews, so the goal is to avoid wasting time on the tool itself. Once again, time limits at Meta are a huge factor, so speed is critical.

That said, even with perfect preparation, interviewers might not always be in a good mood or may judge unfairly. The interview process has its power dynamics, but with insider knowledge, you’ll have done as much as you can on your end to secure a Strong Hire decision.
Рекомендации по теме
Комментарии
Автор

Prepping for a phone screen soon and I just wanted to leave a comment saying I really appreciate these videos, especially the variants and the pacing. Will try to watch through all of them this month, keep posting please thanks!

albertvu
Автор

I think there is one more variant, n, and m are not given and its also not specified that m = list_a.size() / 2,

In that case, b = list_b.size() -1, a = list_a.size() - list_b.size() - 1

MitzzGotarne
Автор

Bookmarked to finish later. Keep up the good work!

psychedamike
Автор

mujhe aata hua question bhi seekhne ki zaroorat lag rahi hai

sanyattaneja
Автор

The video is great, you need to keep promoting your channel. Is not hard.

Bathya
Автор

really enjoyed the videos, thanks so much! also a little feedback here: we also need to decrement i in each loop...

Jessica-gurn
Автор

Quick question. In the variation, if list a is double the size of list b, then that means the sizes of the lists are the same. In that case if my starting index for list b is b, won't that be the same starting index for list a as well? Do we really need to do the division by 2 etc? Thanks for the videos btw!!

TravelGrid
Автор

Why can't we just iterate from start instead of end, if number in arr1 is bigger than one in arr2 just swap the numbers and move arr1 pointer. When zeroes starts appearing copy the numbers fron arr2. We don't need n and m in this method, it is simpler and works in the variant too

harshwardhankumar
Автор

class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int a = m - 1;
int b = n - 1;
int i = m + n - 1;

for(; i >= 0 && b >= 0; i--) {
if(a >= 0 && nums1[a] > nums2[b]) {
nums1[i] = nums1[a--];
}
else {
nums1[i] = nums2[b--];
}
}
}
};


here is my code I liked your explanation.

pablobear
Автор

We can we can also write like this

If library not included then do
#include<bits/stdc++.h>

int n1=nums1.size();
int n2=nums2.size();
set<int>st;

for(int i=0; i<n1; i++){
st.insert(nums1[i]);
}
for(int i=0; i<n2; i++){
st.insert(nums2[i]);
}
vector<int>temp; //it is used just to store solution in temp

for(auto it:st){
temp.push_back(it);
}
return temp;

VedantKumbharkar-fx
Автор

the author of the thumbnail to this video is a genius

NormalHuman
Автор

Hey I saw some people said that Meta actually asks merge 3 sorted array or list somewhere, but I am not sure if that's array or linked list? Do you know ?

Hikaru-uk
Автор

Can't we just initialize pointer a and b both at len(list_b)-1? Since len(list_a) = 2*len(list_b).

vinitacharya
join shbcf.ru