Tip 1 : Participate in contest it would improve your examination temperament.
Tip 2 : Prepare OOPs, Networking, OS and System design along with DSA
Tip 3 : Make good projects (at least 2).
Tip 1 : Don't bluff in resume.
Tip 2 : Add coding profiles as it shows you have explored and shown interest in coding.
a. Given an big queue of below struct:
struct Log {
string machineName; //M1, M2…
string errorCode; //E1, E2…
int level; //0-error, 1-warning, 2-info
};
Write a program which can read the queue and generate the below information when the total number of logs with level 0 and 1 reach more than a threshold.
M1 E1 count
M1 E2 count
...
I used unordered map of unordered map which keeps track of count for machine code and error code as [machine code][error code] = count and the question can be easily solved afterwards.
Interviewer told me to do this in more systematic manner I used OOPs concepts and he was happy with that
I straight away applied depth first search on this problem and maintained a count of water bodies in the answer variable. This was the most optimal solution, so he twisted this question and asked another one.
I first explained O(n^2) approach to the interviewer and he asked me to optimise. I then used kadane's algorithm and he asked me to code it. I coded and he asked me to find the print the subarray also. I added two if else statements in loop as follows:
for(i=0; i prev_max){
end = i;
start_o = start;
prev_max = curr_max;
}
}