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