Tip 1 : Prepare Data Structures
Tip 2 : Solve atleast 300-400 problems
Tip 3 : Prepare computer science subjects for solving MCQ's
Tip 1 : Projects around oops would be great
Tip 2 : Be confident about everything you write
1st round was the coding round which consists of 25 MCQ’s and 2 Programming Questions. I don't remember the coding questions but one was from arrays and one from strings.
I used DFS from every unvisited node. There is a cycle in a graph only if there is a back edge present in the graph.
To find the back edge to any of its ancestor keep a visited array and if there is a back edge to any visited node then there is a loop and return true.
Traverse from right and find the first item that is not following the descending order.
Swap the found character with closest greater (or smallest greater) element on right side of it.
After swapping, sort the string after the position of character found.
• 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.
I gave him two three approaches.
Brute force
using utility class
using in-order traversal:
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which SQL keyword removes duplicate records from a result set?