Meta Onsite first leg E5/E4 two interviews

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-04-15Added By Anonymous
Source: Link

Company: Meta
Role: e4, e5
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

March 8th I got the following problems, did both and did great. Then I got the move to the onsite mail just after 2 hours from the screening.

Phone Screen:
https://leetcode.com/problems/basic-calculator-ii/
https://leetcode.com/problems/valid-palindrome-ii

Started the first leg of the onsite today, April 15th.

1-System Design round: Design Judge contest System like Leetcode
I suggested:
LB -> SubmissionService-> Kafka -> Workers -> Mysql
User / Problems/Testcases/Contest/Submission tables
I guess I did fair to pass in terms of discussion.

Second round:
I got the following problems:
https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses/description/
I did it on time / run dry test cases
Second was: https://leetcode.com/discuss/interview-question/124616/Facebook-or-Merge-two-interval-lists

I eventually wrote the following code which is right:
I spent the first 15 mins trying to solve it in the same loop.
Then I split the processing into two consecutive loops:
1-Merge the two intervals into one union list
2-Merge Algo for the union list
but that happened just 3 mins before the end.
Run dry test at the final minute.

I feel down, frustrated for some reason. I am preparing for Leadership principles and one more round after tomorrow. Did I lose my chances already? Or anyone got any motivational facts for me.

public static List<int[]> merge(List<int[]> a, List<int[]> b) {
int i= 0 ;
int j = 0;
List<int[]> res = new ArrayList<>();
while(i < a.size() && j <b.size()) {
if(a.get(i)[0] > b.get(j)[0]) {
res.add(b.get(j));
j++;
} else {
res.add(a.get(i));
i++;
}
}

while(i < a.size()) {
res.add(a.get(i));
i++;
}

while( j < b.size()) {
res.add(b.get(j));
j++;
}

List<int[]> finalRes = new ArrayList<>();
finalRes.add(res.get(0));
int k = 1;
while(k < res.size()) {
int[]lastEntry = finalRes.get(finalRes.size()-1);
int[]curr = res.get(k);
if(lastEntry[1] > curr[0]) {
finalRes.set(finalRes.size()-1, new int[]{lastEntry[0], Math.max(lastEntry[1], curr[1])});
} else {
finalRes.add(curr);
}
k++;
}
for(int l = 0; l < finalRes.size() ; l++) {
System.out.print("["+finalRes.get(l)[0] + "," +finalRes.get(l)[1]+" ]");
}

return finalRes;


}

Comments