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 an online MCQ + coding round where we had 1 hour to solve the MCQ's and another 1 hour to solve 2 coding
questions. The MCQ's were related to both General and Technical Aptitude and the coding questions were relatively
easy if one has a decent grip on Data Structures and Algorithms.



For ‘N’ = 3,
All possible combinations are:
((()))
(()())
(())()
()(())
()()()
Approach :
generate function:
It will take a number of arguments:
‘TOTAL’ - an integer representing the total number of characters i.e twice the number of pairs.
‘OPEN’ - an integer representing the number of opening brackets till now.
‘CLOSE’ - an integer representing the number of closing brackets till now.
‘S’ - a string representing the parenthesis till now.
‘ANS’ - a vector of string to store all the generated parenthesis.
1) If the size of the string becomes equal to ‘TOTAL’’, that means that a valid parenthesis is generated, we will store it in the ‘ANS’ vector.
2) If ‘OPEN’ is greater than ‘CLOSE’,
2.1) Then we can give a closing bracket at this index.
2.2) Again if ‘OPEN’ is less than ‘TOTAL’ / 2, we can also give an opening bracket at this index.
3) Else we can only give an opening bracket at this index.
given function :
1) Declare a variable ‘TOTAL’ with a value twice as ‘N’, since each pair consists of two characters.
2) Declare a vector of strings ‘ANS’ to store all the valid parentheses.
3) Call the generate function with zero opening bracket, zero closing bracket, and an empty string.
4) Finally, return the ‘ANS’ vector.
TC : O(2 ^ N), where N is the total number of characters.
SC : O(1)



If a string has 'x' repeated 5 times, replace this "xxxxx" with "x5".
The string is compressed only when the repeated character count is more than 1.
The consecutive count of every character in the input string is less than or equal to 9.
Approach :
1) Keep two indices, both starting from the initial character. Let’s say, ‘STARTINDEX’ and ‘ENDINDEX’. These indices are going to tell the start and end of the substring where the characters are the same.
2) Start moving the ‘ENDINDEX’ to every character till the character at ‘STARTINDEX’ is a match.
3) Whenever there is a mismatch, we can calculate the frequency of the character at the ‘STARTINDEX’ by subtracting the ‘STARTINDEX’ from ‘ENDINDEX’.
4) Append the character at the ‘STARTINDEX’ with its total frequency and add it to the final string you want to return. If the frequency of the character is 1, no need to append its frequency.
5) Move the ‘STARTINDEX' to ‘ENDINDEX’.
6) Repeat until all the characters are traversed in this manner.
TC : O(N), where N = length of the string
SC : O(1)
The interviewer asked me 1 coding problem in this round where I was expected to first explain my approach with proper complexity analysis and then code the solution. After that, some more questions related to DBMS and OOPS were also asked in this round.



Each pair should be sorted i.e the first value should be less than or equals to the second value.
Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
Approach :
1) Initialize a list to store our results.
2) For each element in the array ‘ARR[i]’, we will check whether there exists an element equals to ('S' - ‘ARR[i]’) already in the map.
3) If it exists we will add the pair('ARR[i]', ‘S’ - ‘ARR[i]’ ) ‘COUNT’ number of times to the list, where ‘COUNT’ represents the frequency of ('S' - ‘ARR[i]’) in the map.
4) Also, we will increment the frequency of the current element ('ARR[i]') in the map. Sort the list of pairs as per the given output format and return this list.
TC : O(N^2), where N = size of the array
SC : O(N)
Explain the difference between the DELETE and TRUNCATE command in a DBMS.
DELETE command : This command is needed to delete rows from a table based on the condition provided by the WHERE clause.
1) It deletes only the rows which are specified by the WHERE clause.
2) It can be rolled back if required.
3) It maintains a log to lock the row of the table before deleting it and hence it’s slow.
TRUNCATE command : This command is needed to remove complete data from a table in a database. It is like a DELETE command which has no WHERE clause.
1) It removes complete data from a table in a database.
2) It can be rolled back even if required. (Truncate can be rolled back in some databases depending on their version but it can be tricky and can lead to data loss).
3) It doesn’t maintain a log and deletes the whole table at once and hence it’s fast.
Explain different languages present in DBMS.
Following are various languages present in DBMS:
1) DDL(Data Definition Language): It contains commands which are required to define the database.
E.g., CREATE, ALTER, DROP, TRUNCATE, RENAME, etc.
2) DML(Data Manipulation Language): It contains commands which are required to manipulate the data present in the database.
E.g., SELECT, UPDATE, INSERT, DELETE, etc.
3) DCL(Data Control Language): It contains commands which are required to deal with the user permissions and controls of the database system.
E.g., GRANT and REVOKE.
4) TCL(Transaction Control Language): It contains commands which are required to deal with the transaction of the database.
E.g., COMMIT, ROLLBACK, and SAVEPOINT.
What is Early Binding and Late Binding in C++ ?
OOP is used commonly for software development. One major pillar of OOP is polymorphism. Early Binding and Late
Binding are related to that. Early Binding occurs at compile time while Late Binding occurs at runtime. In method
overloading, the bonding happens using the early binding. In method overriding, the bonding happens using the late
binding. The difference between Early and Late Binding is that Early Binding uses the class information to resolve
method calling while Late Binding uses the object to resolve method calling.
Early Binding : In Early Binding, the class information is used to resolve method calling. Early Binding occurs at
compile time. It is also known as the static binding. In this process, the binding occurs before the program actually
runs. Overloading methods are bonded using early binding.
Late Binding : In Late Binding, the object is used to resolve method calling. Late Binding occurs at runtime. It is also
known as dynamic binding. In this process, the binding occurs at program execution. Overridden methods are
bonded using late binding.
This round had 1 Algorithmic question wherein I was supposed to code the problem after discussing their approaches and respective time and space complexities . After that , I was grilled on some OOPS concepts related to C++.



Let the array = [ 4, 2, 1, 5, 3 ]
Let pivot to be the rightmost number.

Approach :
1) Select any splitting value, say L. The splitting value is also known as Pivot.
2) Divide the stack of papers into two. A-L and M-Z. It is not necessary that the piles should be equal.
3) Repeat the above two steps with the A-L pile, splitting it into its significant two halves. And M-Z pile, split into its
halves. The process is repeated until the piles are small enough to be sorted easily.
4) Ultimately, the smaller piles can be placed one on top of the other to produce a fully sorted and ordered set of
papers.
5) The approach used here is reduction at each split to get to the single-element array.
6) At every split, the pile was divided and then the same approach was used for the smaller piles by using the method
of recursion.
Technically, quick sort follows the below steps:
Step 1 − Make any element as pivot
Step 2 − Partition the array on the basis of pivot
Step 3 − Apply quick sort on left partition recursively
Step 4 − Apply quick sort on right partition recursively
//Pseudo Code :
quickSort(arr[], low, high)
{
if (low < high)
{
pivot_index = partition(arr, low, high);
quickSort(arr, low, pivot_index - 1); // Before pivot_index
quickSort(arr, pivot_index + 1, high); // After pivot_index
}
}
partition (arr[], low, high)
{
// pivot - Element at right most position
pivot = arr[high];
i = (low - 1);
for (j = low; j <= high-1; j++)
{
if (arr[j] < pivot)
{
i++;
swap(arr[i], arr[j]);
}
}
swap(arr[i + 1], arr[high]);
return (i + 1);
}
Complexity Analysis :
TC : Best Case - O(N*log(N))
Worst Case - O(N^2)
SC : Average Case - O(log(N))
Worst Case - O(N)
Explain the difference b/w Dangling Pointer and Void Pointer
Dangling Pointer :
1) A dangling pointer is a pointer that occurs at the time when the object is de-allocated from memory without modifying the value of the pointer.
2) It points to the deleted object.
3) It usually occurs at the object destruction time.
4) Dangling pointer errors can only be avoided just by initializing the pointer to one NULL value.
5) The dangling pointer will be with a free() function in C.
Void Pointer :
1) A void pointer is a pointer that can point to any data type.
2) A void pointer can be assigned the address of any data type.
3) The representation of a pointer to the void is the same as the pointer of the character type.
4) A void pointer can store an object of any type.
5) It is also called a general-purpose pointer.
Difference b/w Call by Value and Call by Reference in C++
Call by Value : In this parameter passing method, values of actual parameters are copied to function’s formal parameters and the two types of parameters are stored in different memory locations. So any changes made inside functions are not reflected in actual parameters of the caller.
//Pseudo Code :
void change(int x)
{
x=x+10;
cout<<"Value of x in the function = "< Change not reflected
Call by Reference : Here both the actual and formal parameters refer to the same locations, so any changes made inside the function are actually reflected in actual parameters of the caller.
//Pseudo Code :
void change(int &x)
{
x=x+10;
cout<<"Value of x in the function = "< Change reflected
What is Diamond Problem in C++ and how do we fix it?
The Diamond Problem : The Diamond Problem occurs when a child class inherits from two parent classes who both
share a common grandparent class i.e., when two superclasses of a class have a common base class.
Solving the Diamond Problem in C++ : The solution to the diamond problem is to use the virtual keyword. We make
the two parent classes (who inherit from the same grandparent class) into virtual classes in order to avoid two copies
of the grandparent class in the child class.
This was about 30 minutes long interview. First, she asked introduction, after that she was very interested in my internship that I did in summer and about my interests. She asked few common questions on that. Then we discussed about my role.
What are your hobbies? or What are you passionate about?
What are your biggest achievements till date?
What are you most proud of?
Why do you want to work at Infosys?
Tip 1 : Be Confident
Tip 2 : Prepare your resume throughout
Tip 3 : Projects play so important role in your candidature

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
To make an AI less repetitive in a long paragraph, you should increase: