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 a test round where 10 aptitude based questions were to be solved in 60 minutes
5 Pirates and 100 Gold Coins
The answer is 98.
A uses the facts below to get 98 :
Consider the situation when A, B, and C die, only D and E are left. E knows that he will not get anything (D is senior and will make a distribution of (100, 0). So E would be fine with anything greater than 0.
Consider the situation when A and B die, C, D, and E are left. D knows that he will not get anything (C will make a distribution of (99, 0, 1)and E will vote in favor of C).
Consider the situation when A dies. B, C, D, and E are left. To survive, B only needs to give 1 coin to D. So distribution is (99, 0, 1, 0)
Similarly, A knows about point 3, so he just needs to give 1 coin to C and 1 coin to E to get them in favor. So distribution is (98, 0, 1, 0, 1).
N people were in a party and were seated in a circular manner. If each of the two present in the party, except the pairs that were adjacent, sang a song and If a song lasted for 2 mins and 28 mins was taken for singing the songs. How would you solve for N?
The answer: N=7
Solving in a brute force manner,start with the N=4 and continue by increasing the N by 1. Keep checking how many minutes it will take for the condition to be satisfied.
For N=4 , time to sing songs (T) = 4
N=5, T=10
N=6, T=18
N=7, T=28
N=8, T=40
We can see a definite pattern here, For this question T=N*(N-3)
So check for which value of N the equation is true and hence, answer as N=7
Let’s play a game of Russian roulette. You are tied to your chair and can’t get up. Here’s a gun. Here’s the barrel of the gun, six chambers, all empty. Now watch me as I put a single bullet in the gun. I close the barrel and spin it. I put a gun to your head and pull the trigger. Click. Lucky you! Now I’m going to pull the trigger one more time. Which would you prefer, that I spin the barrel first, or that I just pull the trigger?
They took us to the lab for this on and we were each given a paper with a program on it. It was all mixed as in each person got a different paper, You have around an hour to finish coding. after which you have to explain your code. They also gave wrong or incorrect inputs and see how your code handles these exceptions.
If the given string is: STR = "abcde". You have to print the string "edcba".
Try to solve the problem in O(1) space complexity.
This can be done by iterative swapping using two pointers. The first pointer points to the beginning of the string, whereas the second pointer points to the end. Both pointers keep swapping their elements and go towards each other. Essentially, the algorithm simulates the rotation of a string with respect to its midpoint.
Time Complexity : O(n)
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 logK).
For example, Pattern for ‘N’ = 4 will be.
1
232
34545
4567654
printPattern(int n)
{
// Outer loop to handle number of rows n in this case
for (int i = 0; i < n; i++) {
// Inner loop to handle number of columns values changing acc. to outer loop
for (int j = 0; j <= i; j++) {
Print stars (*)
}
Print new line
}
}
Compared to the other round this is more tech oriented. Lot more tech questions. It is of normal difficulty and is not that hard to clear, you only need to know the basics.
Very basic of Data Structure and Oracle knowledge enough. Lots of simple questions from data structures(insert into heaps etc). They did not ask to write code for DS, but rather to explain the logic through diagrams. For some complicated question, they expect how much you brainstorm ideas in solving
1. Make in-place changes, that is, modify the nodes given a binary tree to get the required mirror tree.
This can be solved using recursion.
Steps :
(1) Call Mirror for left-subtree i.e., Mirror(left-subtree)
(2) Call Mirror for right-subtree i.e., Mirror(right-subtree)
(3) Swap left and right subtrees.
temp = left->subtree
left->subtree = right->subtree
right->subtree = temp
Worst-case Time complexity is O(n)
Auxiliary space complexity : O(h) where h is the height of the tree.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the minimum element and place the minimum element at the beginning. We repeat the same process for the remaining elements.
Algorithm :
HeapSort(arr)
BuildMaxHeap(arr)
for i = length(arr) to 2
swap arr[1] with arr[i]
heap_size[arr] = heap_size[arr] ? 1
MaxHeapify(arr,1)
End
BuildMaxHeap(arr)
heap_size(arr) = length(arr)
for i = length(arr)/2 to 1
MaxHeapify(arr,i)
End
MaxHeapify(arr,i)
L = left(i)
R = right(i)
if L ? heap_size[arr] and arr[L] > arr[i]
largest = L
else
largest = i
if R ? heap_size[arr] and arr[R] > arr[largest]
largest = R
if largest != i
swap arr[i] with arr[largest]
MaxHeapify(arr,largest)
End
What is indexing?
Indexing is a data structure technique used to efficiently retrieve records from the database files. It helps optimize the performance of a database by minimizing the number of disk accesses required when a query is processed.
Which is better - B Tree or Hash table?
1. B+ tree is costly to maintain since it needs to be updated after every insertion and deletion.
2. Hash based indexing is efficient in equity queries whereas B+ trees are efficient in range queries.
3. Efficiency of hash based index is low in case of large no. of repeated key values because of hash collision problems.
4. Hash index is not efficient in sorting.
5. Hash index is effective in insertion and deletion whereas B+ tree isn't.
This round lasted for around 30 minutes. It more of a character analysis round with a lot of HR type questions.
1. Give your introduction.
2. Most of the questions were focused on Patient, Hospital, Insurance So they asked me to create a scenario connecting those three entities.
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.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which array operation has O(n) worst-case time complexity?