Tip 1 : Even if you are stuck in the problem, just give a try. The interviewer will help you definitely for sure.
Tip 2 : Prepare Data Structures and Algorithms well. They mostly check our Problem Solving ability to find the solutions for the real world problems.
Tip 3 : Be enough confident, don't be nervous. Maintain atleast 2 projects in your resume
Tip 1 : List the projects and give a brief note about them.
Tip 2 : Place only those skills that you are confident on.



If the input string is ‘str’ = ”aazbbby”, then your output will be “azby”.
Note that we are just removing adjacent duplicates.
At first, I was trying to do it in n passes, where in every pass, we tried to remove adjacent characters. The interviewer asked me to optimize the solution. I used a stack and visited each character only once, reducing the time complexity to O(n).



1. If 'X' is not found in the array, return 0.
2. The given array is sorted in non-decreasing order.
First, I told the interviewer that we could use a hash map to store the count of every element. The interviewer then asked me to reduce the time and space complexity. I subsequently used binary search to find the first and last occurrence of the element and returned the difference between them.



In zigzag order, level 1 is printed from left to right fashion, level 2 is printed from right to left. and level 3 is printed from left to right again, and so on…..
For the given binary tree

The zigzag traversal is [1, 4, 3, 5, 2, 7, 6]
I first tried to print the level order traversal and then modified the approach to print the zigzag traversal.



1. The helper function ‘knows’ is already implemented for you.
2. ‘knows(A, B)’ returns "false", if A doesn't know B.
3. You should not implement helper function ‘knows’, or speculate about its implementation.
4. You should minimize the number of calls to function ‘knows(A, B)’.
5. There are at least 2 people at the party.
6. At most one celebrity will exist.
I was struggling to find the approach and got an idea that it can be solved using two pointer approach to optimize the time complexity and space complexity. I gave my approach and interviewer was happy with it. I tried to write the code. Basic test cases were passed. But one of the edge case is not passed. I tried to modify the code but could not be able to complete it.



1. Horizontally as 1x2 tile
2. Vertically as 2x1 tile
The number of ways might be large so output your answer modulo 10^9 + 7.

I have done this problem earlier so got the DP based approach during the test and this approach passed all the test cases.



Down: (row+1,col)
Right: (row, col+1)
Down right diagonal: (row+1, col+1)
I had practiced enough of DP questions, so, this one looked fairly easy. Since, it was a standard DP question, the same approach worked here too.

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