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.
Technical Interview round with questions based on DSA, Output Prediction etc.



Let the array be [1, 2, 3, 4, 4, 5]. In the given array ‘4’ occurs twice and the number ‘6’ is missing.
XOR approach can be used to solve this question in an efficient manner.
The following property of XOR can be used :
1. If x1^x2^…xn = a and x1^x2^..xn-1 = b , then a^b = xn
Steps:
1. Declare two variables a= 0 and b = 0
2. Calculate the xor of numbers from 1 to n and store them in a i.e. 1^2^…n = a.
3. Now traverse the array from start to end.
4. For every index i update b as b = b ^ arr[i]
5. Return the missing number as a ^ b.
Time Complexity : O(N)
Space complexity : O(1)



1. Only the space character ' ' is treated as a whitespace.
2. All characters other than leading whitespace or digits are considered.
Input: 45rohit12
Output: 45
Explanation:
Leading Whitespace: Leading whitespace characters (" ") are ignored.
Numeric Portion: The numeric portion starts with the digit "4".
Reading Numeric Characters: The algorithm reads "4" and "5" to form "45".
End of Numeric Portion: The numeric portion ends at "r", non-numeric characters are skipped.
Parsing Result: "45" is parsed into the integer value 45, the final result.
The idea is to use the ASCII value of the digits from 0 to 9 start from 48 – 57.
Therefore, to change the numeric character to an integer subtract 48 from the ASCII value of the character will give the corresponding digit for the given character.
Pseudocode :
convert(string s)
{
// Initialize a variable
num = 0;
for (i=0 to length of string)
// Subtract 48 from the current digit
num = num * 10 + (int(s[i]) - 48);
// Print the answer
print(num)
}



For a given string “BaaB”
3 possible palindrome partitioning of the given string are:
{“B”, “a”, “a”, “B”}
{“B”, “aa”, “B”}
{“BaaB”}
Every substring of all the above partitions of “BaaB” is a palindrome.
The problem can be solved using recursion. If the given string is a palindrome, 0 cuts are needed. Otherwise, try making cuts at all possible positions and calculate the cost for each cut recursively and take the minimum of all costs.
// i is the starting index and j is the ending index.
Initially, i=0 and j=n-1
minCuts(str, i, j) = 0 if i == j // When string is of length 1.
minCuts(str, i, j) = 0 if str[i..j] is palindrome.
// If the above conditions are not true, then minimum cuts needed can be calculated recursively using the following formula.
minCuts(str, i, j) = min { minCuts(str, i, k) + 1 + minCuts(str, k+1, j) }
where k varies from i to j-1
The above approach can be optimized using dynamic programming. A 2-d array can be used to store the intermittent results calculated in recursive functions.
The time complexity of this approach would be O(N^3).
This was a technical interview round with 2 interviewers. Questions based on DSA, OOPS , DBMS were asked.



The idea is to recursively calculate height of left and right subtrees of a node and assign height to the node as max of the heights of two children plus 1.
Algorithm:
maxDepth()
1. If tree is empty then return -1
2. Else
(a) Get the max depth of left subtree recursively i.e., call maxDepth( tree->left-subtree)
(a) Get the max depth of right subtree recursively i.e., call maxDepth(tree->right-subtree)
(c) Get the max of max depths of left and right subtrees and add 1 to it for the current node.
max_depth = max(max dept of left subtree, max depth of right subtree) + 1
(d) Return max_depth



In the below graph, there exists a cycle between vertex 1, 2 and 3.

1. There are no parallel edges between two vertices.
2. There are no self-loops(an edge connecting the vertex to itself) in the graph.
3. The graph can be disconnected.
Input: N = 3 , Edges = [[1, 2], [2, 3], [1, 3]].
Output: Yes
Explanation : There are a total of 3 vertices in the graph. There is an edge between vertex 1 and 2, vertex 2 and 3 and vertex 1 and 3. So, there exists a cycle in the graph.
DFS can be used to detect cycle in an undirected graph. Do a DFS traversal of the given graph. For every visited vertex ‘v’, if there is an adjacent ‘u’ such that u is already visited and u is not parent of v, then there is a cycle in graph.
If we don’t find such an adjacent for any vertex, we say that there is no cycle.
Pseudocode :
DetectCycle(graph, v, visited[], parent)
{
// mark the current node as visited
visited[v] = true;
// do for every edge (v, w)
for (w: graph[v])
{
// if `w` is not visited yet
if (!visited[w])
{
if (DetectCycle(graph, w, visited, v)) {
return true;
}
}
// if `w` is visited, and `w` is not a parent
else if (w != parent)
{
// back-edge (cycle) found
return true;
}
}
// No back-edges were found in the graph
return false;
}
Write a SQL query to multiply two matrices.
Assuming the following structure:
A (row INT, col INT, value FLOAT)
B (row INT, col INT, value FLOAT)
You can write this:
SELECT A.row, B.col, SUM(A.value * B.value)
FROM A JOIN B ON A.col = B.row
GROUP BY A.row, B.col
Can a constructor be virtual?
In C++, the constructor cannot be virtual, because when a constructor of a class is executed there is no virtual table in the memory, means no virtual pointer defined yet. So, the constructor should always be non-virtual.
Can a destructor be virtual?
Yes, it is possible to have pure virtual destructor. Pure virtual destructors are legal in standard C++ and one of the most important things to remember is that if a class contains a pure virtual destructor, it must provide a function body for the pure virtual destructor.
Can a constructor be private in C++?
By default, constructors are defined in public section of class. But yes, Constructor can be defined in private section of class
This was a group activity round where we were divided in group of 3 and 4. 8 or 9 panelists were watching us.
We were given a list of servers databases and client systems having pros and cons. We were asked to choose the best possible combination that suits all client requirements.
HR round with typical behavioral problems.
1. Tell something about yourself
2. Greatest achievement in your life
3. Achievements of others that you like
4. The interviewer then gave me a scenario like you are team leader and you have to instruct your team to deliver blood from blood bank to hospital very fast as someone's life is in danger..
5. Then he asked me If I was a team player?
6. He was like what you do to motivate your team as a leader and how would you make your team perform best?
7. Do you want to ask some thing to me?
Tip 1 : Be sure to do your homework on the organization and its culture before the interview.
Tip 2 : Employers want to understand how you use your time and energy to stay productive and efficient. Be sure to emphasize that you adhere to deadlines and take them seriously.
Tip 3 : Talk about a relevant incident that made you keen on the profession you are pursuing and follow up by discussing your education.

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?