Tip 1 : Follow basics of all algorithms and prepare all related questions.
Tip 2 : Try out easy to medium level questions
Tip 3 : Prepare projects, DBMS, OS
Tip 1 : Make it short and crisp
Tip 2 : Must add your projects
It was mostly coding. Firstly I was asked my intro followed by two coding questions. Interviewer was very polite, he first gave his intro and then asked for mine and then he jumped directly onto the coding questions.



Let the array be [1, 2, 3, 4, 4, 5]. In the given array ‘4’ occurs twice and the number ‘6’ is missing.
Approach 1 - I took a map and iterated over all the elements to store frequency of each element. it helped to find out the repeated number. then sorted the array and start iterating over all the elements from I = 1 until the the missing element is not found. (I was asked to solve it without taking any space)
Approach 2 - let the missing number be x;
let the receptive number be y;
now add all elements of the array sum of all elements => n(n+1)/2 = sum of all elements +x -y (where n is total no of elements)
after this add square of each element => n(n+1)(2n+1)/6 = sum of square of all elements + x^2 - y^2;
now we have two variables and two equations, it can be solved easily.
sum of first n natural number is n(n+1)/2;
sum of square of first n natural numbers is n(n+1)(2n+1)/6



‘ARR1’ = [3 6 9 0 0]
‘ARR2’ = [4 10]
After merging the ‘ARR1’ and ‘ARR2’ in ‘ARR1’.
‘ARR1’ = [3 4 6 9 10]
Approach 1 ; take another array - add elements from both the arrays to the new array one by one and then sort the new array - time complexity nlogn
Approach 2 - compare each element of array1 and array2, add the smallest element to the new array and increment the iterator from where value is added to the new array until the iterator from both the array reached to the last element
Interviewer was a little late during this round because of some production issue. I was asked one coding question and some mcq and also discussed my projects.



1. You can not slant the container i.e. the height of the water is equal to the minimum height of the two lines which define the container.
2. Do not print anything, you just need to return the area of the container with maximum water.

For the above Diagram, the first red marked line is formed between coordinates (2,0) and (2,10), and the second red-marked line is formed between coordinates (5,0) and (5,9). The area of water contained between these two lines is (height* width) = (5-2)* 9 = 27, which is the maximum area contained between any two lines present on the plane. So in this case, we will return 3* 9=27.
Approach - 1 ; I started running two loops one from I = 0; and another j = I+1 and find out the Oil stored between I & j . if it exceeds the the value of maximumStoredOil(Initialised with INT_MIN) then replace the value in maximumStoredOil
this approach is taking O(n^2) so the interviewer asked me to reduce the time complexity
Approach - 2; I took two pointers ( I = 0, j = n-1), one in the beginning and one in the last. and started finding out the oil stored between the two pipe by (j-i) * min (hight[I], height[j]) . if the minimum height is on the left the we will increment the interator and if it is on the right then we will decrement the iterator ans we will keep finding the height and making a record of maximum stored water
This round was taken by the head of engineering. he asked me one coding question and then we discussed our projects.



Input:
'num1' : 1 -> 2 -> 3 -> NULL
'num2' : 4 -> 5 -> 6 -> NULL
Output: 5 -> 7 -> 9 -> NULL
Explanation: 'num1' represents the number 321 and 'num2' represents 654. Their sum is 975.
So I was getting two linked list
Input 1->2->3
4->5->5
output 5->7->8
1. reverse both the linked list
2. start iterating over both the linked list, take one elements from each list add them and keep the record of carry to take forward. add the summed value in a new linked list.
3. once iteration is complete, check if carry is 1 add one more node with value 1.
4. reverse the sum linked list.
5. return the head of sum linked list
He asked multiple question related to design patterns of my projects-
1. What is difference between monolith and Microservices?
2. What is database sharing?
3. What is master slave architecture?
4. What are the best practices of debugging?

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