WhiteHat Jr Interview Experience for Software Engineer | 2 Years Experienced
LLD: Design a vehicle rental system.
Should be able to design extendible system and code should be compilable and executable and meet the requirements given
- Find the median of two sorted arrays
1. Using merge operation of merge sort generate auxiliary array and find the median
- Time complexity – O(m + n)
- Space complexity – O(m + n)
- if m + n is odd then (m + n) / 2th element
- if m + n is even then (((m + n) / 2)th + (((m + n)/2) – 1)th) / 2
- So instead of storing all values in auxiliary array when merging store the current and prev elements until current != ((m + n)/2)th element
- Bottom view of a binary tree (https://www.geeksforgeeks.org/bottom-view-binary-tree/)
Hint – store the horizontal distances of each node for each level.
- Find if string is rotation of another string.
Given a string `abcde` and another string `dea` find if `dea` is a rotation of `abcde`.
In this case, should return true.
If the strings are `abcde` and `bde` it will return false.
2. Level order traversal of a binary tree, print each level in a new line.
An additional approach was asked to extend code for n-ary tree
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google , E-Litmus and Microsoft Test Serieses.