Tip 1 : Practice Atleast 250 Questions Leetcode
Tip 2 : For DSA questions in interviews, start explaining from the brute force approach and then move to the optimal one. Convey your thought process to the interviewers, so that they can help you out if you get stuck.
Tip 3 : Do not write anything that you are not confident of in resume
Tip 4 : Do atleast 2 projects
Tip 1 : Try to include at least one development project in your resume.
Tip 2 : Interviewer will ask anything from your resume so be prepared for it.
Tip 3 : Don't mention some random projects which you are not sure about or copied from Google or somewhere else.
The first round was based on algorithms, pseudo-codes, 2-3 questions from DBMS and CN, 3 coding questions, and 3 DBMS queries.
Consider the case ‘ninja’array is [ 1, 2, 3, 4 ], ‘enemies’array is [ 2, 1, 4, 5 ] and ‘allowedSwaps’ are = [ [ 0, 1 ], [ 2, 3 ] ] so after swapping in best manner according to ‘allowedSwaps’ our ‘ninja’ array becomes [ 2, 1, 4, 3 ]. So minimum Hamming distance is ‘1’ as now there is only one different element as compared to ‘ninja’ and ‘enemies’ array index.
1. You are allowed to do as many swap operations on the ‘ninja’ array as you want but according to the ‘allowedSwap’ array.
2. You are not required to print anything explicitly. It has already been taken care of. Just implement the function.
Step 1 : Calculate the XOR of two numbers.
Strp 2 : Count the number of set bits.
A graph where all vertices are connected with each other has exactly one connected component, consisting of the whole graph. Such a graph with only one connected component is called a Strongly Connected Graph.
The problem can be easily solved by applying DFS() on each component. In each DFS() call, a component or a sub-graph is visited. We will call DFS on the next un-visited component. The number of calls to DFS() gives the number of connected components. BFS can also be used.
It was a TR+HR round .
The interviewer started with “Tell me about yourself”. Then he asked some Java fundamental questions then he sked me the lifecycle of Software development. In HR round I was asked about what I know about Cognizant why I want to join this particular company, Am i okay with relocation, How can I contribute to companies growth etc.
F(n) = F(n - 1) + F(n - 2),
Where, F(1) = 1, F(2) = 1
"Indexing is start from 1"
Input: 6
Output: 8
Explanation: The number is ‘6’ so we have to find the “6th” Fibonacci number.
So by using the given formula of the Fibonacci series, we get the series:
[ 1, 1, 2, 3, 5, 8, 13, 21]
So the “6th” element is “8” hence we get the output.
step 1 : initilize a = 0 and b = 1
step 2 : for i = 1 to i = n:
print(a)
temp = a+b
a = b
b = temp
You live in Dubai and had an infinite supply of oil and a 5 liters and 3 liters jar,
how would you measure exactly 4 liters (of-course in minimum numbers of step) ?
Fill the 5-liter bowl. Then fill the 3-liter bowl from the 5-liter bowl. You will now have 2 liters left in the 5 liter bowl.
Empty the 3-liter bowl, and then transfer the 2 liters from the 5-liter bowl into it.
Now fill the 5-liter bowl again, then pour water carefully from the 5-liter bowl into the 3-liter bowl until it is full - exactly one more liter.
The 5-liter bowl now has exactly 4 liters.
You have a birthday cake and have to cut it into 8 equal pieces by making 3 cuts only. How do you do it?
The solution can be divided into 3 basic steps. But apart from this there are also other method of executing this task.
Step 1: Cut the cake into quarters (4 pieces) using 2 of the cuts – one horizontally down the centre of the cake and the other vertically down the centre of the cake. This will leave you with 4 pieces (or slices) of cake.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which SQL keyword removes duplicate records from a result set?