Tip 1 : Do Competitive Programming continuously
Tip 2 : Practice DS Algo questions on regular basis.
Tip 3 : Do at least one good project.
Tip 1 : Have some projects on your resume
Tip 2 : You must have in-depth knowledge of the project
Aptitude section (consisting of 15 questions and duration was 20 minutes).
CS fundamental section (consisting of 15 questions and duration was 15 minutes)
The last one was the coding section which was consisted of 2 coding questions and duration was 45 minutes.



A book will be allocated to exactly one ninja.
At least one book has to be allocated to a ninja.
Allotment of the books should be done in a contiguous manner. For example, a ninja can not be allocated book 2 and book 4, skipping book 3.
I solve it using Binary Search



1. "ARR" can contain duplicates.
Input: 'N' = 4 , "ARR" = [5, 10 , 2] and 'K' = 3.
Output: 1
Explanation : Currently, the difference between the maximum and minimum element in the array is 10 - 2 = 8, which is greater than K (3).
So, we need to remove some elements. The optimal way to get our result is to remove 10. After removing 10, the difference between maximum and minimum is 5 - 2 = 3, which is less than or equal to K.
The idea was to pick an element from the array in such a way that in each step at most two elements from the array will be removed.
2 coding questions



class BinaryTreeNode {
int data; // Value of the node.
BinaryTreeNode *left; // Pointer to left child node.
BinaryTreeNode *right; // Pointer to right child node.
BinaryTreeNode *next; // Pointer to next right node at same level.
}
Consider the figure shown below. The left part represents the initial binary tree and right part represents the binary tree after connecting adjacent nodes at the same level.

In the tree shown in the picture above -:
The ‘next’ pointer of the node having value 2 is connected to the node having value 3.
The ‘next’ pointer of the node having value 4 is connected to the node having value 5.
The ‘next’ pointer of the node having value 5 is connected to the node having value 6.
The ‘next’ pointer of nodes having value 1, 3, 6 will have a value NULL as there are no next right nodes in their cases.
1. The structure of the ‘Node’ of a binary tree is already defined. You should not change it.
2. The root of the binary tree is known to you.
3. There is at least one node in the given binary tree.
4. You may only use constant extra space.
Firstly I solve the problem using O(N) extra space but he was only interested in constant space solutions, he does not allow me to even use recursion stack space. Finally, I was able to write the complete iterative solution. He checks my solution for some custom inputs and then checks for all corner cases, and he was very satisfied with my solution.


If the given matrix is:
[ [1, 2, 5],
[3, 4, 9],
[6, 7, 10]]
We have to find the position of 4. We will return {1,1} since A[1][1] = 4.
The second question was an easy one that why he asked me to code the problem in just five minutes. I was able to write the code in the given time frame and the interviewer seems to be very satisfied.
2 coding question from DS
Questions from OS and DBMS and OOPS



The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:

You don't need to print anything. It has already been taken care of. Just implement the given function.
Two Pointer Approach
At every index, The amount of rainwater stored is the difference between the current index height and a minimum of left max height and right max-height



If N = 2 and prerequisite = [[1, 2]]. Then, there are a total of 2 courses you need to take. To take course 1 you need to finish course 2. So, it is possible to complete all courses.
I try to find the order of courses using topological sorting and then give various approaches to the interviewer to find the minimum number of semesters, but she does not seem to be satisfied.
What is LRU and how you can implement it?
What is MRU and ask for real-time examples of MRU in practical life?
Ask me to write code for this problem.
How we can make search and insert operations efficient in Data Bases queries.
Various scheduling algorithms in Operating System.
She gives me some test cases and then asks me for the output (Project-based test cases).
2 coding question and one puzzle



I solve problem using memorization



Let's say the given array is [ 9, 98, 7].
All the possible numbers formed by concatenating each of the array elements are 7989,7998,9879,9897,9987,9798. Among the six numbers, 9987 is the greatest number. Hence the answer is 9987.
I solve problem using coustom sorting
There are 25 horses among which you need to find out the fastest 3 horses. You can conduct race among at most 5 to find out their relative speed. At no point you can find out the actual speed of the horse in a race. Find out the minimum no. of races which are required to get the top 3 horses.
Difference between thread and process.
Can two threads access the same data at the same time?
Deadlock and necessary conditions for deadlock.
Normal behavioral questions

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?