Tip 1 : 250 Leetcode ( Easy- 70, Medium- 150, Hard- 30)
Tip 2 : Don't underestimate importance of good projects on your Resume.
Tip 3 : Be Confident.
Tip 1: Resume should not be more than 1 page.
Tip 2: Have Keywords on Resume that match Job descriptions.
3 Questions were asked : 2- Trees and 1- Stack.
Interviewer was not receptive at all, I think this was a stress interview.
• The left subtree of a node contains only nodes with data less than and equal to the node’s data.
• The right subtree of a node contains only nodes with data greater than and equal to the node’s data.
• Both the left and right subtrees must also be partial binary search trees.
Level 1:
All the nodes in the left subtree of 4 (2, 1, 3) are smaller
than 4, all the nodes in the right subtree of the 4 (5) are
larger than 4.
Level 2 :
For node 2:
All the nodes in the left subtree of 2 (1) are smaller than
2, all the nodes in the right subtree of the 2 (3) are larger than 2.
For node 5:
The left and right subtree for node 5 is empty.
Level 3:
For node 1:
The left and right subtree for node 1 are empty.
For node 3:
The left and right subtree for node 3 are empty.
Because all the nodes follow the property of a Partial binary
search tree, the above tree is a Partial binary search tree.
Inorder Traversal and Check if previous element is smaller than next one
• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
Because only 5 is greater than 4 in the above BST, node 4 will be updated to 9 (4 + 5 = 9).
Nodes 3, 4, and 5 are greater than 2, hence node 2 will be modified to 14 (2 + 3 + 4 + 5 = 14).
Node with data 5 will remain the same because there is no node in the BST with data greater than 5.
Nodes 2,3, 4, and 5 are greater than 1, hence node 1 will be modified to 15 (1 + 2 + 3 + 4 + 5 = 15).
Nodes 4 and 5 are greater than 3, hence node 3 will be modified to 12 (3 + 4 + 5 = 12).
I took Reverse Inorder in this approach and started from last element in right subtree
Traversed the Tree in Reverse Inorder Fashion Right Root Left.
'S' = "{}()".
There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.
I used Stack data structure for this problem and Solved in O (n) Space Complexity
Interviewer asked to optimise this to O(1) Space which i was not able to optimise.
2 Coding Questions were asked, both were of Medium to Hard Difficulty.
All the different rows are merged into a single row.
I used BFS approach here, and made use of Queue Data structure
I kept on storing Child elements of a node in Queue.
The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:
You don't need to print anything. It has already been taken care of. Just implement the given function.
I used two Arrays here Min and Max to store all elements min/max for a Particular element
Timing : It was late night.
How the interviewer was? He was very tired and I had to lead the discussion.
1 System Design Question was asked, had to provide - HLD, LLD, APIs.
Tip 1: Ask clarifying questions and make sure you boil down to Minimum Viable product
Tip 2: Restrict Scope of problem to essential Features for eg: Customer support, Discounts/Offers can be pushed to Future Requirements.
Tip 3: Keep talking to interviewer and ask if you are going in right direction, there is not a single solution for design, so make sure you justify your designs like - I will use NoSQL, but why ? Justify that, I will use some XYZ tech, why is this best ?
Tip 4: System Design round can go till 4 hours but you just always plan to complete in 60-90 minutes. keep a time check for every 10 minutes and see on which section you are.
Timing : Afternoon
How was the environment? Home
Interviewer : Hiring Manager
Discussed about past Projects, challenges faced, disagreements with manager, why looking for job switch, leadership principle questions were asked.
I answered all questions very confidently and was prepared for all Leadership questions. Each answer should be fitting one or two leadership principle.
Timing - Afternoon
How was the environment? Home
How the interviewer was? Very Helpful Interviewer
Bar raiser Round - Coding + System Design + Leadership principle
Tip 1: Ask clarifying questions and make sure you boil down to Minimum Viable product
Tip 2: Write down all Entities and Interface and make use of OOPs Concepts like abstraction, Encapsulation, etc
Tip 3: Design patterns is a good to have, you can showcase this skill for SDE 2.
Discussed about the Offer and Location.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you create a function in JavaScript?