Tip 1 : Try it even if you are stuck in the problem. The interviewer will help you.
Tip 2 : Prepare Data Structures and Algorithms well. They mainly check our ability to find solutions to real-world problems.
Tip 3 : Be confident enough, don't be nervous. Maintain at least two projects on your resume.
Tip 1 : Mention atleast 2 projects.
Tip 2 : Mention your skills in which you are perfect.
Tip 3 : It should not be too long or too short



For the trees given below:-

The given trees are identical as:-
1. The number of nodes in both trees is the same.
2. The number of edges in both trees is the same.
3. The data for root for both the trees is the same i.e 5.
4. The data of root -> left (root’s left child) for both the trees is the same i.e 2.
5. The data of root -> right (root’s right child) for both the trees is the same i.e 3.
6. The data of root -> right -> left ( left child of root’s right child) for both the trees is the same i.e 6.
7. Nodes with data 2 and 6 are the leaf nodes for both the binary trees.



ARR_2D = [
[0, 1],
[2, 3, 4],
[],
[5]
]
The computed ‘ARR_1D’ should be as follows:
ARR_1D = [0, 1, 2, 3, 4, 5]
So, the printed output will be: 0 1 2 3 4 5



The same word from a dictionary can be used as many times as possible to make sentences.



The distance is calculated as |i1 – i2| + |j1 – j2|, where i1, j1 are the coordinates of the current cell and i2, j2 are the coordinates of the nearest cell having value 1.
You can only move in four directions which are : Up, Down, Left and Right.
If N = 3, M = 4
and mat[ ][ ] = { 0, 0, 0, 1,
0, 0, 1, 1,
0, 1, 1, 0 }
then the output matrix will be
3 2 1 0
2 1 0 0
1 0 0 1
The idea is to load the i and j coordinates of each ‘1′ in the Matrix into a Queue and then traverse all the “0” Matrix elements and compare the distance between all the 1’s from the Queue to get a minimum distance



We have to follow the step:
Find the LCA of the given two nodes
Store the path of two-node from LCA in strings S1 and S2 that will store ‘l’ if we have to take a left turn in the path starting from LCA to that node and ‘r’ if we take a right turn in the path starting from LCA.
Reverse one of the strings and concatenate both strings.
Count the number of time characters in our resultant string not equal to its adjacent character.



Binary Search Tree is a node-based binary tree data structure that has the following properties:
1. The left subtree of a node contains only nodes with keys lesser than the node’s key.
2. The right subtree of a node contains only nodes with keys greater than the node’s key.
3. The left and right subtree each must also be a binary search tree.
A Binary Heap is a Binary Tree with the following property:
1. It’s a complete tree (all levels are filled except possibly the last level and the last level has all keys as left as possible). This property of Binary Heap makes them suitable to be stored in an array.
A Binary Heap is either Min Heap or Max Heap. In a Min Binary Heap, the key at the root must be minimum among all keys present in Binary Heap. The same property must be recursively true for all nodes in Binary Tree. Max Binary Heap is similar to Min Heap.
Given:- BST’s ‘ROOT’ = 4 2 6 -1 -1 -1 -1
Then the min-heap in pre-order fashion would be 2 4 6.
Create an array arr[] of size n, where n is the number of nodes in the given BST.
Perform the inorder traversal of the BST and copy the node values in the arr[] in sorted
order.
Now perform the postorder traversal of the tree.
While traversing the root during the postorder traversal, one by one copy the values from the array arr[] to the nodes.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?