Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
This was an online MCQ + coding round where we had 1 hour to solve the MCQ's and another 1 hour to solve 2 coding
questions. The MCQ's were related to both General and Technical Aptitude.



Elements are in the level order form. The input consists of values of nodes separated by a single space in a single line. In case a node is null, we take -1 in its place.
For example, the input for the tree depicted in the below image would be :

1
2 3
4 -1 5 6
-1 7 -1 -1 -1 -1
-1 -1
Explanation :
Level 1 :
The root node of the tree is 1
Level 2 :
Left child of 1 = 2
Right child of 1 = 3
Level 3 :
Left child of 2 = 4
Right child of 2 = null (-1)
Left child of 3 = 5
Right child of 3 = 6
Level 4 :
Left child of 4 = null (-1)
Right child of 4 = 7
Left child of 5 = null (-1)
Right child of 5 = null (-1)
Left child of 6 = null (-1)
Right child of 6 = null (-1)
Level 5 :
Left child of 7 = null (-1)
Right child of 7 = null (-1)
The first not-null node (of the previous level) is treated as the parent of the first two nodes of the current level.
The second not-null node (of the previous level) is treated as the parent node for the next two nodes of the current level and so on.
The input ends when all nodes at the last level are null (-1).
The above format was just to provide clarity on how the input is formed for a given tree.
The sequence will be put together in a single line separated by a single space. Hence, for the above-depicted tree, the input will be given as:
1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1
Approach : I approached this problem using DFS .
1) Create a boolean recursive function with parameters as root and target .
2) If we reached at the leaf node (root and !root->left and !root->right) and target-root->value==0 , return true as we
found out a path that sums up to target.
3) If root is not null , call 1) dfs with root->left and target-root->val and 2) dfs with root->right and target-root->value .
Return the OR of both these values.
TC : O(N) where N=number of nodes in the binary tree.
SC : O(N)


Approach :
1) Run a loop from i = 2 to i = min(m, n).
2) Find the remainder for (m / i) and (n / i).
3) If both the remainders are zero, then m and n are not co-prime.
4) If you run through the entire loop without finding an 'i' that divides both m and n, then they are co-prime.
TC : O(min(m, n)), where m and n are the two input integers.
SC : O(1)
This was a standard DSA round where I was given 2 coding questions - the first one was related to DP and the second one was of Linked List. I first explained my approach and then coded the solutions in a production ready manner by applying proper coding principles.



Given Pairs = [3,4], [1,2], [2,3].
The length of the maximum chain will be 2. The longest chain is [1,2] -> [3,4].
1. You can select a pair only once.
2. You needn’t use up all the given pairs.
3. You can select pairs in any order.
Approach (Using DP) : This problem is a variation of LIS (longest increasing subsequence).
1) We will sort the array according to the first element to define an order of picking pairs in the chain.
2) Now the elements are sorted according to the first elements we need to find the longest increasing subsequence according to their second elements.
3) We will use a ‘DP’ table of size ‘N’ to calculate the results for each index. Definition: ‘DP’[i] will store the max length pair chain ending at index ‘i’.
4) Base case: Each pair can make a valid chain of length 1 so we initialize each entry in the ‘DP’ table with value 1.
5) Transitions: If the current pair is the ending element of the chain then the maximum length of pair chain ending at this pair will be 1 + maximum ‘DP[j]’ where 0<= ‘j’ < ‘i’ and the first element of the current pair is greater than the second element of the pair having index ‘j’.
6) The final answer will be the maximum length among all the lengths we found so far in our ‘DP’ table.
TC : O(N ^ 2), where N = number of pairs
SC : O(N)



The given linked list is 1 -> 2 -> 3 -> 2-> 1-> NULL.
It is a palindrome linked list because the given linked list has the same order of elements when traversed forwards and backward.
Can you solve the problem in O(N) time complexity and O(1) space complexity iteratively?
Approach (Using Recursion) :
1) Recursively traverse the entire linked list to get the last node as a rightmost node.
2) When we return from the last recursion stack. We will be at the last node of the Linked List. Then the last node value is compared with the first node value of Linked List.
3) In order to access the first node of Linked List, we create a global left pointer that points to the head of Linked List initially that will be available for every call of recursion and the right pointer which passes in the function parameter of recursion.
4) Now, if the left and right pointer node value is matched then return true from the current recursion call. Then the recursion falls back to (n-2)th node, and then we need a reference to the 2nd node from head. So we advance the left pointer in the previous call to refer to the next node in the Linked List.
5) If all the recursive calls are returning true, it means the given Linked List is a palindrome else it is not a palindrome.
TC : O(N), where N = number of nodes in the linked list
SC : O(N)
This round started with 2 preety decent coding questions - one from DP and the other one was from Binary Search. This was followed by some questions from OOPS and then the interview ended with the interviewer asking me the famous 3-Ants and the Triangle Puzzle.



If ‘ARR’ is {1,2,3,4} and ‘K’ = 4, then there exists 2 subsets with sum = 4. These are {1,3} and {4}. Hence, return true.
Approach (Using DP) :
1) Create a boolean 2D array/list ‘DP’ of size (‘N+1’)*(‘K+1’) i.e. ‘DP[N+1][K+1]’.
2) If ‘K’ is equal to 0, then the answer should be ‘true’. Hence, run a loop from 0 to ‘N’ (say iterator = ‘i’):
‘DP[i][0]’ = true.
3) If ‘K’ is not zero but ‘ARR’ is empty then the answer should be ‘false’. Hence, run a loop from 1 to ‘K’ (say iterator =
‘i’):
‘DP[0][i]’ = false.
4) To fill the ‘DP’ table, run a loop from 1 to ‘N’ (say iterator = ‘i’):
4.1) Run a loop from 1 to ‘K’ (say iterator = ‘j’):
‘DP[i][j]’ = ‘DP[i-1][j]’.
4.2) If ‘j’ is greater than equal to ‘ARR[i-1]’:
‘DP[i][j]’ = ‘DP[i][j]’ OR ‘DP[i-1][j - ARR[i-1]]’.
5) Finally, return ‘DP[N][K]’.
TC : O(N*K), where N = size of the array and K = required sum
SC : O(N*K)



1. If ‘k’ is not present in 'arr', then print -1.
2. There are no duplicate elements present in 'arr'.
3. 'arr' can be rotated only in the right direction.
Input: 'arr' = [12, 15, 18, 2, 4] , 'k' = 2
Output: 3
Explanation:
If 'arr' = [12, 15, 18, 2, 4] and 'k' = 2, then the position at which 'k' is present in the array is 3 (0-indexed).
Approach (Using Binary Search) :
1) Find the mid index.
2) If the value(key) being searched for is at the mid index, then return the mid index.
3) Compare values at start index, end index, and mid-index:
3.1) If the left subarray is sorted, check if the value(key) to be searched lies in the range:
a) If it does, then search space reduces between [start, (mid-1)].
b) Otherwise, the search space reduces between [(mid + 1), end]
3.2) If the right subarray is sorted, check if the value(key) to be searched lies in the range:
a) If it does, then search space reduces between [(mid + 1), end].
b) Otherwise, the search space reduces between [start, (mid -1)]
4) Repeat from step-1 until the key is found.
5) Return -1 if never found.
TC : O(log(N)), Where N = size of the array.
SC : O(1)
What is meant by static and dynamic polymorphism?
Static Polymorphism : Static Polymorphism is commonly known as the Compile time polymorphism. Static polymorphism is the feature by which an object is linked with the respective function or operator based on the values during the compile time. Static or Compile time Polymorphism can be achieved through Method overloading or operator overloading.
Dynamic Polymorphism : Dynamic Polymorphism or Runtime polymorphism refers to the type of Polymorphism in OOPs, by which the actual implementation of the function is decided during the runtime or execution. The dynamic or runtime polymorphism can be achieved with the help of method overriding.
What is Abstraction?
If you are a user, and you have a problem statement, you don't want to know how the components of the software work, or how it's made. You only want to know how the software solves your problem. Abstraction is the method of hiding unnecessary details from the necessary ones. It is one of the main features of OOPs.
For example, consider a car. You only need to know how to run a car, and not how the wires are connected inside it. This is obtained using Abstraction.
3 Ants and Triangle
Collision doesn’t happen only in following two cases :
1) All ants move in counterclockwise direction.
2) All ants move in clockwise direction.
Since every ant has two choices (pick either of two edges going through the corner on which ant is initially sitting),
there are total 23 possibilities.
Out of 23 possibilities, only 2 don’t cause collision. So, the probability of collision is 6/8 or 3/4 and the probability of
non-collision is 2/8 or 1/4.
This was a Technical Cum HR round where I was first asked some basic OOPS related concepts and then we discussed
about my expectations from the company , learnings and growth in the forthcomig years. I would suggest be honest and
try to communicate your thoughts properly in these type of rounds to maximise your chances of getting selected.
Do you know anything about the company ?
General Tip : Before an interview for any company , have a breif insight about the company , what it does , when was
it founded and so on . All these info can be easily acquired from the Company Website itself .
Why should we hire you ?
Tip 1 : The cross questioning can go intense some time, think before you speak.
Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
like what are the projects currently the company is investing, which team you are mentoring. How all is the work
environment etc.
Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical
questions. No coding in most of the cases but some discussions over the design can surely happen.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which SQL clause is used to specify the conditions in a query?