Meta Onsite first leg E5/E4 two interviews

Anonymous User
267
Apr 15, 2024

Marh 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 15 April.
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 to two conscutive loops
1-Merge the two intervals at one union list
2-Merge Algo for the union list
but that happend just 3 mins before the end
run dry test at the final min.

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

public static List<int[]> megre(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 (2)