Tip 1 : Practice different types of questions
Tip 2 : Be honest while preparing
Tip 3 : Be clear with your topics
Tip 1 : Be honest with your resume
Tip 2 : Be smart with your resume
The round was scheduled for 5 days and we can take the test anytime as per the convenience.



'str' = abcad and 'k' = 2.
We can see that the substrings {ab, bc, ca, ad} are the only substrings with 2 distinct characters.
Therefore, the answer will be 4.
The problem can be solved in O(n*n). Idea is to maintain a hash table while generating substring and checking the number of unique characters using that hash table.



1. Each node is associated with a unique integer value.
2. The node for which the successor is to be found is guaranteed to be part of the tree.
1. If the right subtree of node is not NULL, then succ lies in right subtree. - Go to right subtree and return the node with minimum key value in the right subtree.
2. If right subtree of node is NULL, then start from the root and use the search-like technique. - Travel down the tree, if a node’s data is greater than root’s data then go right side, otherwise, go to left side.
It was an afternoon round and the interviewers were friendly and supportive.



Input: 'arr' = [1,1,2,2,4,5,5]
Output: 4
Explanation:
Number 4 only appears once the array.
Exactly one number in the array 'arr' appears once.
An Efficient Solution can find the required element in O(log n) time. The idea is to use Binary Search.
All elements before the required have the first occurrence at even index (0, 2, ..) and the next occurrence at odd index (1, 3, …). And all elements after the required elements have the first occurrence at an odd index and the next occurrence at an even index.
1) Find the middle index, say ‘mid’.
2) If ‘mid’ is even, then compare arr[mid] and arr[mid + 1]. If both are the same, then the required element after ‘mid’ and else before mid.
3) If ‘mid’ is odd, then compare arr[mid] and arr[mid – 1]. If both are the same, then the required element after ‘mid’ and else before mid.



‘ARR1’ = [3 6 9 0 0]
‘ARR2’ = [4 10]
After merging the ‘ARR1’ and ‘ARR2’ in ‘ARR1’.
‘ARR1’ = [3 4 6 9 10]
It was an evening round.



1. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes at the last level are as far left as possible.
2. All the node values are positive.
3. The size of the linked list is greater than 1.
4. The end of the linked list is represented by -1.
Think about which data structure to be used to traverse binary tree in spiral order. The idea is to use a direction variable and decide whether to pop elements from the front or from the rear based on the value of this direction variable.

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?