Tip 1 : Code More
Tip 2 : Study Data Structures
Tip 3 : Be Confident
Tip 1: Mention only what you are confident about.
Tip 2: Mention the tools and technologies used in the project as well.
If 'ARR' is [4,2,1,3] ,it can be splitted into two subsequences as [4,2,1] , [3] or [4,3],[2,1].
Input: 'a' = [7, 12, 1, 20]
Output: NGE = [12, 20, 20, -1]
Explanation: For the given array,
- The next greater element for 7 is 12.
- The next greater element for 12 is 20.
- The next greater element for 1 is 20.
- There is no greater element for 20 on the right side. So we consider NGE as -1.
It was held at 10 AM in the morning.
The interviewer was very friendly.
I was asked to solve two coding questions and was continuously provided with hints by the interviewer.
The questions were on arrays and trees.
1. A binary tree is a tree in which each node can have at most two children.
2. The given tree will be non-empty i.e the number of non-NULL nodes will always be greater than or equal to 1.
3. Multiple nodes in the tree can have the same values, all values in the tree will be positive.
You need to modify the given tree only. You are not allowed to create a new tree.
For the given binary search tree
11 will be replaced by {15 + 29 + 35 + 40}, i.e. 119.
2 will be replaced by {7 + 11 + 15 + 29 + 35 + 40}, i.e. 137.
29 will be replaced by {35 + 40}, i.e. 75.
1 will be replaced by {2 + 7 + 11 + 15 + 29 + 35 + 40}, i.e. 139.
7 will be replaced by {11 + 15 + 29 + 35 + 40}, i.e. 130.
15 will be replaced by {15 + 29 + 35 + 40}, i.e. 104.
40 will be replaced by 0 {as there is no node with a value greater than 40}.
35 will be replaced by {40}, i.e. 40.
Evening 5 PM. The interviewer was very friendly and provided various hints. It covered complex coding questions on tree data structures.
For the given binary tree
The level order traversal will be {1,2,3,4,5,6,7}.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which operator is used for exponentiation in Python?