Tip 1 : Focus on fundamentals and have crystal clear concepts on data structures and algorithms
Tip 2 : Practice programming as much as you can, at least 200 problems
Tip 3 : Have solid problem solving skills
Tip 1 : Add your technical achievements.
Tip 2 : Add your 2 major projects done.
Online round was of on MCQ's and 2 coding problems based on data structures and algorithms.



Each pair should be sorted i.e the first value should be less than or equals to the second value.
Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
The steps to solve the problem are as followed:
1. Initialize a variable, say countPairs, to store the count of distinct pairs of the array with sum K.
2. Sort the array in increasing order.
3. Initialize two variables, say i = 0, j = N – 1 as the index of left and right pointers to traverse the array.
4. Traverse the array and check for the following conditions:
5. If arr[i] + arr[j] == K: Remove consecutive duplicate array elements and increment the countPairs by 1. Update i = i + 1
and j = j – 1.
6. If arr[i] + arr[j] < K then update i = i + 1.
Otherwise, update j = j – 1.
7. Finally, print the value of countPairs.



str = "ababc"
The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome.
There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
The idea is to Fix a center and expand in both directions for longer palindromes and keep track of the longest palindrome seen so far.
The steps to solve this problem are as follows -
1. Maintain a variable ‘ maxLength = 1 ‘ (for storing LPS length) and ‘ start =0 ‘ (for storing starting index of LPS ).
2. The idea is very simple, we will traverse through the entire string with i=0 to i<(length of string).
1. while traversing, initialize ‘low‘ and ‘high‘ pointer such that low= i-1 and high= i+1.
2. keep incrementing ‘high’ until str[high]==str[i] .
3. similarly keep decrementing ‘low’ until str[low]==str[i].
4. finally we will keep incrementing ‘high’ and decrementing ‘low’ until str[low]==str[high].
5. calculate length=high-low-1, if length > maxLength then maxLength = length and start = low+1 .
3. Print the LPS and return maxLength.
Coding easy and medium level problems were asked in this round.



A binary tree is a tree in which each parent node has at most two children.
A binary heap tree has the following properties.
1. It must be a complete binary tree. In the complete binary tree every level, except the last level, is completely filled and the last level is as far left as possible.
2. Every parent must be greater than its all children nodes.
Consider this binary tree:

Figure 1 is a complete binary tree because every level, except the last level, is completely filled and the last nodes are as far left as possible, and the level has 2 nodes both on the left side.
Figure 2 is not a complete binary tree because level 2 (level is 0 based) is not completely filled means the right child of the node (36) is missing.
There is another reason, in the last level, there can be one another node in between node (1) and node (14) to make the binary tree as far left as possible.
1. In the world of programming two types of binary heap tree possible:
a. Min-heap - if all parents nodes are lesser than its children nodes.
b. Max-heap - if all parents nodes greater than its children nodes, explained in the above figure-1.
2. In this problem binary heap tree is a binary max-heap tree.
The steps to solve the problem are as follows -
In the array representation of a binary tree, if the parent node is assigned an index of ‘i’ and left child gets assigned an index of ‘2*i + 1’ while the right child is assigned an index of ‘2*i + 2’. If we represent the above binary tree as an array with the respective indices assigned to the different nodes of the tree above from top to down and left to right.
Hence we proceed in the following manner in order to check if the binary tree is complete binary tree.
1. Calculate the number of nodes (count) in the binary tree.
2. Start recursion of the binary tree from the root node of the binary tree with index (i) being set as 0 and the number of nodes in the binary (count).
3. If the current node under examination is NULL, then the tree is a complete binary tree. Return true.
4. If index (i) of the current node is greater than or equal to the number of nodes in the binary tree (count) i.e. (i>= count), then the tree is not a complete binary. Return false.
5. Recursively check the left and right sub-trees of the binary tree for same condition. For the left sub-tree use the index as (2*i + 1) while for the right sub-tree use the index as (2*i + 2).



Approach: DFS on Tree
* On each node, Recursively store what value it would have if you choose vs not choosing it. Store both values :)
* If you choose current node, then you will have to add child node's not_choose values.
* If you don't choose current node, then you can add maximum of child node's choose, not_choose values.
Problem solving questions were asked.


The steps to solve the problem are as follows -
1. The problem can be solved using simple recursive traversal.
2. We can keep track of level of a node by passing a parameter to all recursive calls.
3. The idea is to keep track of maximum level also and traverse the tree in a manner that right subtree is visited before
left subtree.
4. Whenever we see a node whose level is more than maximum level so far, we print the node because this is the last node in its level.
5. And also note that we traverse the right subtree before left subtree.



insert(word) - To insert a string "word" in Trie
search(word) - To check if string "word" is present in Trie or not.
startsWith(word) - To check if there is any string in the Trie that starts with the given prefix string "word".
Type 1: To insert a string "word" in Trie.
1 word
Type 2: To check if the string "word" is present in Trie or not.
2 word
Type 3: To check if there is any string in the Trie that starts with the given prefix string "word".
3 word
Why you want to join us?
Why should we hire you?
Questions on projects.
Tip 1 : Be confident.
Tip 2 : Show them that you can excel in your job.
Tip 3 : Be strong technically, especially in programming.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?