MediaNet(DirectI) Interview Experience for SDE-2 (2-3 Years Experienced)
Arranged by a recruiter. They conduct a total of 3 rounds for SDE2
Round 1: 3 questions on DS-Algo of Medium difficulty
Hey geek! It's time to become a success story instead of reading them. Check out our most renowned DSA Self Paced Course, now at a student-friendly price and become industry ready. And if you are looking for a more complete interview preparation resource, check out Complete Interview Preparation Course that will prepare you for the SDE role of your dreams!
Feeling prepared enough for your interview? Test your skills with our Test Series that will help you prepare for top companies like Amazon, Microsoft, TCS, Wipro, Google and many more!
Given a binary tree, count the total number of uni-valued subtrees. A uni-valued subtree is one that has left and right subtree with the same value.
Example: Ans 5 (all leaf nodes 3 + subtrees 2)
2 / \ 2 2 / \ 2 2
Ans: The post-order traversal to check at parent level if children are subtree or not. Leaf nodes are already subtree in itself.
Given an array of unsorted numbers. U r given a window of size k. Partition the array such that the sum of the max sum of the left subarray and max sum of the right sub-array is maximum. Just find the sum, also, the sub-arrays should be non-overlapping.
Example:
1 3 5 7 4 1 9 6 8 N = 9 , k = 3 {5 7 4} + {9 6 8} = 39Given an unsorted array, find the length of the longest subarray of consecutive numbers
Example:
7 1 5 8 9 3 4 2
Ans. Two subarrays are formed
1 2 3 4 5 7 8 9
Hence, the consecutive array is of length 5.
Tip: sorting is naive O(nlogn). Improvise it to O(n) time. Use hashmap
Round 2: Write a wrapper function that can process fast retrieval of a unique number. The function doesn’t have any parameters. Given function fetches unique numbers from the DB and it is already implemented. Int fetch(int n) –> get n unique values.
Ans: It’s a Producer-Consumer pattern-based problem and you have to use multi-threading here
- Maintain 2 lists. Call async when a list gets empty and return from the other.
- Blocking queue


