Tip 1 : Primary skill to be developed is problem solving, i.e proficient in data structures and algorithms.
Tip 2 : After this, practice competitive programming, start giving contests, this will make you faster.
Tip 3 : Then take any technology, e.g., machine learning, web development etc., make few but good projects using these technologies.
Tip 1 : Make it short, 1-2 pages max. Only mention those projects that you know the best.
Tip 2 : While mentioning projects, do mention numbers in them, like what was the accuracy(in case of ML projects).
The test was scheduled at 2:30 PM, IST. The test was conducted online, due to the ongoing pandemic situation. Webcam was required to be switched on during the complete duration of the test. I had solved 2/2 coding questions with all test cases successfully passing. Out of the 10 MCQ questions, I had done 6. Around 90 students sat for the online coding round, 19 were shortlisted for the interview. Those who had solved both coding questions were called for interview.
Given students' ratings : [5, 8, 1, 5, 9, 4].
He gives the students candy in the following minimal amounts : [1, 2, 1, 2, 3, 1]. He must buy a minimum of 10 candies.
1. If two students having the same grade are standing next to each other, they may receive the same number of candies.
2. Every student must get at least a candy.
Step 1: Since we had to see adjacent students' marks, and then decide the candy to be given, dynamic programming struck my mind.
Step 2: We need to look in both sides, left as well as right. So I constructed an array, say left, in the first traversal.
1) Yuki can buy 1 more blade with cost 'A.’ He now has ‘K+1’ Ninja blades.
2) Yuki could buy a ‘K’ number of blades with cost 'B.’ He now has ‘2*K’ blades.
where 'A' and 'B' are predefined and constant.
There can be two or more ways with the exact cost. You can consider any one of them, but the overall cost to reach from 0 to 'N' must be minimized.
Consider Yuki need to buy 5 blades, the cost of adding 1 blade is 2, and the cost of doubling the blades is 1 then you have to perform the following operations:
1) Doubling 0 will result in 0 only, so add 1 blade to 0 blades with cost 2. Total cost becomes 2.
2) Next, you can either double 1 to reach 2 or add 1 blade. But since the cost of doubling is less than that of adding, so double 1 with cost 1. Total cost becomes 3.
3) Doubling 2 will result in 4 with a cost of 1. Total becomes 4.
4) Adding 1 in 4 will result in 5 (which is the desired number) with a cost of 2. The total cost to reach 5 becomes 6.
This was a simple DP based problem. Construct a DP array of size n+1. And fill the array as follows:
For i between 2 to n:
1). If i is even: then we can reach that i by two ways, one is by adding 1 to i-1, another by doubling i/2, and add their respective costs.
Therefore, dp[i] = min(dp[i-] + A, dp[i/2] + B);
2). If i is odd. This is a bit tricky, one option is adding one to i-1. Since this is not an even no. so we cant divide it by 2.
The approach is to add one to i, now it will be an even no, and now we can find dp[(i+1)/2], since now its even.
Therefore, dp[i] = min(dp[i-1] + A, dp[(i+1)/2] + A + B);
This was a pure DSA based round. Two questions were asked in this round. The interviewer was quite good, and helped in between.
The first stream is “b” and the first non-repeating character is ‘b’ itself, so print ‘b’.
The next stream is “bb” and there are no non-repeating characters, so print nothing.
The next stream is “bba” and the first non-repeating character is ‘a’, so print ‘a’.
The next stream is “bbac” and the first non-repeating character is ‘a’, so print ‘a’.
The next stream is “bbaca” and the first non-repeating character is ‘c’, so print ‘c’.
I had solved this question earlier, thanks to Coding Ninja's Codezen. I was able to give the optimised solution. I used the concept of deque. The question was based on the concept of sliding window.
You need to make the modifications in the input matrix.
You do not need to print anything, it has already been taken care of.
I started with the naive approach. I suggested storing the location of all 1s in an array. Then traverse over this array and make required changes in the matrix.
The interviewer asked me to optimise it further. I suggested, when we encounter a one, start making changes in the matrix as: if m[i][j] is 0 then change it to 1, else change the value to -1, so that we know a 1 was present here and change its respective column to 1 when we arrive there.
He further asked me to optimise it, I wasn't able to think of a solution, though he seemed satisfied with the discussion we had.
This round was also again focused on DSA. Two interviewers were present. This round was very extensive and everything was asked in depth as well as they asked to write the codes as well for all the questions. I was also asked to explain my projects, they were based on ML. Many aspects of OOPs, POP, memory allocation was asked as well.
1. The array follows 0-based indexing.
2. In one rotation operation, all elements of the array will shift either towards the left or right by one index.
3. The element at the extreme left index (i.e. 0th index) will shift to the 'N-1'th index after applying one left rotation on the array and the rest all the elements will shift to the 'i-1'th index.
4. The element at the extreme right index (i.e. 'N-1'th index) will shift to the 0th index after applying one right rotation on the array and the rest of the elements will shift to the 'i' + 1'th index.
first found the value of f(0). Now what we need to do is assign last element the index 0, then in next iteration, the 2nd last element as index 0 and last as index 1.
So i ran a loop from 1 to n, and i in each iteration, the last i elements were assigned indices starting from 0. After that, continuing from the last index that was assigned to the last element, we start picking elements from the start.
Sum these values and calculate the maximum over all of them.
1. Two nodes may have the same value associated with it.
2. Average of any level is computed as the sum of the values of all the nodes at that level divided by the number of nodes at that level.
3. You will be given the 'ROOT' node of the binary tree.
4. You need to print the floor value for each average. For example, if the average of node values at some level is 3.5 then you have to print 3.
This was a simple BFS traversal problem. I was also asked to write the code for the same. I was able to code it successfully.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What does ROLLBACK do in DBMS?