Tip 1: Do a lot of hard work and practice Data Structures and Algorithm based questions
Tip 2: I recommend Coding Ninjas and Geeks For Geeks for interview preparation.
Tip 1 : Make your resume short.
Tip 2 : Try to make it one page only, and do mention all your skills that you are confident of in your resume.



For 'arr' = [ 1, 2, 3, 1, 2]. you need to return 1.
Ninja is given an array of integers that contain numbers in random order. He needs to write a program to find and return the number which occurs the maximum times in the given input. He needs your help to solve this problem.
If two or more elements contend for the maximum frequency, return the element which occurs in the array first i.e. whose index is lowest.



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.



A sequence 'A' is a subsequence of a sequence 'B' if 'A' can be obtained from 'B' by deletion of several (possibly, zero) elements. For example, [3,1] is a subsequence of [3,2,1] and [4,3,1], but not a subsequence of [1,3,3,7] and [3,10,4].
I initially tried a 2D DP solution where dp[i][j] indicates the length of the longest sequence with ending at i containing j as a digit. It’s a N X 10 DP matrix. The interviewer asked me why I needed a 2D DP solution and I struggled to convince him. I wrote the code for it. It wasn’t completely correct. I was missing something. After thinking for a while I narrowed down to a solution containing only 10 elements dp[0], dp[1], dp[2].. dp[9] which is updated every time I see a new number. I take a number, I go through all digits in the number and find value = 1 + max(dp[d] for all digits d in the number). Set this value to dp[d] for all digits in the number. He gave a hint to take the max and finally gave a solution to the interviewer and he was satisfied with that solution.



Try to solve the problem in 'Single Scan'. ' Single Scan' refers to iterating over the array/list just once or to put it in other words, you will be visiting each element in the array/list just once.
I solved this question using three-pointers and this problem was a variation of dutch national flag problem. The interviewer was satisfied by my approach as this was the most optimal approach.



Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams.
'triangle' and 'integral'
'listen' and 'silent'
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct.
I implemented it first by sorting two strings and comparing them. He asked me to write a better approach. So I used a hashmap to do it.
What are the differences between threads and processes? (Learn)
This is most basic question of OS and I explained it very well using a tabular representation.
What are the Deadlocks and their prevention? (Learn)
I firstly told him necessary conditions for deadlock and then explained him that if we don’t let all conditions fulfilled for deadlock then it may be prevented.



Operation 1 - insert(word) - To insert a string WORD in the Trie.
Operation 2- search(word) - To check if a string WORD is present in Trie or not.
Operation 3- startsWith(word) - To check if there is a string that has the prefix WORD.

The above figure is the representation of a Trie. New words that are added are inserted as the children of the root node.
Alphabets are added in the top to bottom fashion in parent to children hierarchy. Alphabets that are highlighted with blue circles are the end nodes that mark the ending of a word in the Trie.
Type = ["insert", "search"], Query = ["coding", "coding].
We return ["null", "true"] as coding is present in the trie after 1st operation.
I wrote a class to implement a character, Trie, using a vector of nodes as children. He asked me to improve on space. So I used a hashmap to store the child nodes only if a child exists. I wrote the code for insertion and finding a word and walked him through it.

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