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.
Interviewer was mainly focused on problem solving skill.



Input: 'a' = [2, 4, 6] and 'b' = [1, 3, 5]
Output: 3.5
Explanation: The array after merging 'a' and 'b' will be { 1, 2, 3, 4, 5, 6 }. Here two medians are 3 and 4. So the median will be the average of 3 and 4, which is 3.5.
The most basic approach is to merge both the sorted arrays using an auxiliary array. The median would be the middle element in the case of an odd-length array or the mean of both middle elements in the case of even length array.
The merging of two sorted arrays can be done in a way similar to merge sort. The time complexity of this approach would be O(n+m).
A better solution is to use binary search.
Steps :
1. Find the length of the smaller arrays of the two. Perform binary search on the smaller array.
2. Initialize two pointers - start = 0 and end = m (assuming m is the smaller length).
3. Run a while loop : while (start <= end) { ... }.
4. Calculate the partition index (partitionA) for a which is the mid-point of start and end i.e., (start + end) / 2.
5. Calculate the partition index (partitionB) for b which is (m + n + 1) / 2 - partitionA.
6. Find the maximum element in the left of a and b and minimum element in the right of a and b.
Now, we can have three cases -
(i) If (maxLeftA <= minRightB && maxLeftB <= minRightA), then return the median based on (m + n) is even or odd.
(ii) Else If (maxLeftA > minRightB), it means, we need to go on the left, so, set end = partitionA - 1.
(iii) Else, we need to go to the right, so, set start = partitionA + 1.



Can you solve each query in O(logN) ?
This was a pretty standard Binary Search Question and I had solved this question before on platforms like LeetCode and CodeStudio . I was asked this question to test my implementation skills and how well do I handle Edge Cases .
Approach :
1) The idea is to find the pivot point, divide the array in two sub-arrays and perform binary search.
2) The main idea for finding pivot is – for a sorted (in increasing order) and pivoted array, pivot element is the only element for which next element to it is smaller than it.
3) Using the above statement and binary search pivot can be found.
4) After the pivot is found out divide the array in two sub-arrays.
5) Now the individual sub – arrays are sorted so the element can be searched using Binary Search.
TC : O(Log(N))
SC : O(1)
Technical Interview Round with questions on DSA.



The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked list is 4 -> 3 -> 2 -> 1 -> NULL and the head of the reversed linked list will be 4.
Can you solve this problem in O(N) time and O(1) space complexity?
This can be solved both : recursively and iteratively.
The recursive approach is more intuitive. First reverse all the nodes after head. Then we need to set head to be the final node in the reversed list. We simply set its next node in the original list (head -> next) to point to it and sets its next to NULL. The recursive approach has a O(N) time complexity and auxiliary space complexity.
For solving the question is constant auxiliary space, iterative approach can be used. We maintain 3 pointers, current, next and previous, abbreviated as cur, n and prev respectively. All the events occur in a chain.
1. Assign prev=NULL, cur=head .
2. Next, repeat the below steps until no node is left to reverse:
2.1. Initialize n to be the node after cur. i.e. (n=cur->next)
2.2. Then make cur->next point to prev (next node pointer).
2.3. Then make prev now point to the cur node.
2.4. At last move cur also one node ahead to n.
The prev pointer will be the last non null node and hence the answer.



Consider the array {2,1,5,6,3,8} and 'K' = 3, the sorted array will be {8, 6, 5, 3, 2, 1}, and the 3rd largest element will be 5.
1) Kth largest element in an array is the kth element of the array when sorted in non-increasing order.
2) All the elements of the array are pairwise distinct.
To solve the question using a max heap, make a max heap of all the elements of the list. Run a loop for k-1 times and remove the top element of the heap. After running the loop, the element at top will be the kth largest element, return that. Time Complexity : O(n + klogn)
The question can also be solved using a min heap.
Approach :
1. Create a min heap class with a capacity of k.
2. When the heap reaches capacity eject the minimum number.
3. Loop over the array and add each number to the heap.
4. At the end, the largest k number of elements will be left in the heap, the smallest of them being at the top of the heap, which is the kth largest number.
The time complexity for this solution is O(N*log(K)).

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?