Expedia Group | Onsite Interview | SDE2 | Bangalore, India | Puzzle | 2D Matrix | Binary Tree
Anonymous User
1271

I had Expedia Group Onsite Interview (conducted virtually) for SDE 2 role, Bangalore location. The interview lasted for 1.5 hrs.
Below are the questions -

  1. Puzzle -> There are 3 Jars. One jar contains only orange, one jar contains only apple and the remaining jar contains mix of apple and orange. The mix need not be half half. All the jars given are mislabelled. Label the jars properly. Find the minimum no of fruits you need to take out to label all the jars correctly.
  2. Given a matrix, row wise sorted and column wise sorted. Given a target element search it in the matrix. If the element is found in matrix, return its indices or return Not Found. Return should be string type.
  3. Given a binary tree. Find the maximum height of the binary tree.

My answers in the interview -

  1. Puzzle -> Initially i was confused. Then the interviewer told me that all the jars are mislablled. For example
    Jar 1 -> Apple
    Jar 2 -> Mix of Orange/Apple
    Jar 3 -> Orange
    So when he says mislablled, it means no way i can say that jar 1 can be apple. According to him, jar 1 can never be apple because it says all are mislabled. Initially the answer i gave was wrong. But the interviewer didnt say that. i asked is that ok, then he said the answer given by me is wrong. So again i gave the answer which was correct but he seemed to be not that impressed.
    Solution -> Keep in mind all are mislablled. Jar 2 cannot be mix of orange and apple. Hence take one fruit out of it. Lets say the fruit is orange. Hence jar 2 is definitely orange. Now if jar 2 is orange, that means jar 3 is definitely not orange it can be mix or only apple. Now jar 1 also cannot be only apple as its mislabelled. Hence i can say that jar 3 can be apple and jar 1 can be mix. Hence minimum no of fruits required is 1.

  2. Run a loop for total no of rows. Row wise its sorted and column wise also sorted. Check for every row if the target element is >= first element of row and <= last element of that row. If so, do a binary search on the row elements to find the column index. Return the row and column in string format. If not found, go to next row. Keep doing this for all the rows. After the loop completes, return not found in case there is no element found.

  3. Its a simple leetcode question to find max depth/height of binary tree. I used simple dfs recursion for the solution.

Verdict - Not selected for further rounds.

I dont know the reason why I wasnt selected as i did answer all the questions. Maybe the interviewer didnt like my approach or what I dont know.

Comments (3)