Tip 1: Start learning Data Structures at least a year before your placements.
Tip 2: Focus on OOP concepts, such as inheritance.
Tip 3: Make sure you learn everything about your project.
Tip 1: Mention only the things you are familiar with.
Tip 2: You must have at least two good projects.
This round was conducted in two phases: the morning session was for the MCQ round, and the second session was for the coding assessment. The round took place in university computer labs.
TIP: Please remember the code you wrote during the programming round, as the questions may be asked again.
Seats for Mathematics, Physics and Biology in a school are in the ratio 5: 7: 8. There is a proposal to increase these seats by 40%, 50% and 75% respectively. What will be the ratio of increased seats?
2 : 3 : 4
6 : 7 : 8
6 : 8 : 9
None of these
Originally, let the number of seats for Mathematics, Physics and Biology be 5x, 7x and 8x respectively.
Number of increased seats are (140% of 5x), (150% of 7x) and (175% of 8x).
140 x 5x , 150 x 7x and 175 x 8x
100 100 100
7x, 21x and 14x.
2
The required ratio = 7x : 21x : 14x
2
14x : 21x : 28x
2 : 3 : 4.
A clock is started at noon. By 10 minutes past 5, the hour hand has turned through:
145°
150°
155°
160°
Angle traced by hour hand in 12 hrs = 360°.
Angle traced by hour hand in 5 hrs 10 min. i.e., 31 hrs = 360 x 31 ° = 155°.
What is the port number of PoP?
35
43
110
25
110
What is the primary purpose of pseudocode?
A. To document algorithms in natural language
B. To compile and execute algorithms
C. To debug code
D. To optimize algorithms
Tip 1: Pseudocode is used to document algorithms in a way that is readable to humans, representing how a program will work without worrying about syntax.
Tip 2: Answer: To document algorithms in natural language



Given an array arr[] of size N, the task is to find the length of the Longest Increasing Subsequence (LIS) i.e., the longest possible subsequence in which the elements of the subsequence are sorted in increasing order. Input: arr[] = {3, 10, 2, 1, 20}Output: 3Explanation: The longest increasing subsequence is 3, 10, 20Input: arr[] = {50, 3, 10, 7, 40, 80}Output: 4Explanation: The longest increasing subsequence is {3, 7, 40, 80}
int lisEndAtI(vector& arr, int i)
{
if (i == 0)
return 1;
int mx = 1;
for (int prev = 0; prev < i; prev++)
if (arr[prev] < arr[i])
mx = max(mx, lisEndAtI(arr, prev) + 1);
return mx;
}
int lis(vector& arr)
{
int n = arr.size();
int res = 1;
for (int i = 1; i < n; i++)
res = max(res, lisEndAtI(arr, i));
return res;
}
// Driver program
int main()
{
vector arr = { 10, 22, 9, 33, 21, 50, 41, 60 };
cout << "Length of lis is " << lis(arr);
return 0;
}
output: Length of lis is 5



Cycle Detection in a Singly Linked List. You have given a Singly Linked List of integers, to determine if it forms a cycle or not.
A cycle occurs when a node's next points back to a previous node in the list. The linked list is no longer linear with a beginning and end—instead, it cycles through a loop of nodes.
The idea is to insert the nodes in the hashmap and whenever a node is encountered that is already present in the hashmap then return true.
class Node {
public:
int data;
Node* next;
Node(int new_data) {
this->data = new_data;
this->next = nullptr;
}
};
bool detectLoop(Node* head) {
unordered_set h_map;
while (head != nullptr) {
if (h_map.find(head) != h_map.end())
return true;
h_map.insert(head);
head = head->next;
}
return false;
}
int main() {
Node* head = new Node(10);
head->next = new Node(20);
head->next->next = new Node(30);
head->next->next->next = new Node(40);
head->next->next->next->next = new Node(50);
head->next->next->next->next->next = new Node(60);
head->next->next->next->next = head;
if (detectLoop(head))
cout << "Loop Found";
else
cout << "No Loop";
return 0;
}



Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type.
Example 1:
Input: s = "()"
Output: true
Example 2:
Input: s = "()[]{}"
Output: true
Example 3:
Input: s = "(]"
Output: false
public class Solution {
public static boolean isValid(String s) {
while (true) {
if (s.contains("()")) {
s = s.replace("()", "");
} else if (s.contains("{}")) {
s = s.replace("{}", "");
} else if (s.contains("[]")) {
s = s.replace("[]", "");
} else {
// If the string becomes empty, it indicates all brackets are matched.
return s.isEmpty();
}
}
}
}
This round was conducted online through Google Meet while I was sitting in my room. They asked questions such as:
Why do we need STL when we can perform all the operations using a user-defined data structure and functions? (Learn)
We prefer STL over user-defined data structure and functions because:
It saves time spent writing code for user-defined data structures.
It is tried, efficient, and debugged code tested over a long period.
STL is the part of C++ Language Standard so it is easy to understand for other programmers.
STL allows us to parameterize the code with the required data type.
What is the time complexity of insertion and deletion in vector?
Insertion: If the size of the vector is N, then the time complexity of insertion of an element in the vector is:
At the end: O(1)
At M index: O(N – M)
Deletion: If the size of the vector is N, then the time complexity of deletion of an element in the vector is:
At the end: O(1)
At M index: O(N-M)
// C program to Find the Factorial Using for Loop
unsigned int factorial(unsigned int N) {
int fact = 1, i;
for (i = 1; i <= N; i++) {
fact *= i;
}
return fact;
}
int main() {
int N = 5;
int fact = factorial(N);
printf("Factorial of %d is %d", N, fact);
return 0;
}
// using recursion
unsigned int factorial(unsigned int n) {
if (n == 1) {
return 1;
}
return n * factorial(n - 1);
}
int main() {
int num = 5;
printf("Factorial of %d is %d", num, factorial(num));
return 0;
}
This last round was online conducted through Google Meet by the manager.
I was sitting in my room around 5 pm.



Find the Peak Element in a 2D Array/Matrix.
Examples
Input: [[10 20 15], [21 30 14], [7 16 32]]
Output: 1, 1
Input: [[10 7], [11 17]]
Output: 1, 1
An element is a peak element if it is greater than or equal to its four neighbors, left, right, top and bottom.
A Diagonal adjacent is not considered a neighbour.
A peak element is not necessarily the maximal element.
More than one such element can exist.
There is always a peak element.
For corner elements, missing neighbors are considered of negative infinite value.
vector findPeakGrid(vector > arr)
{
vector result;
int row = arr.size();
int column = arr[0].size();
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
if (i > 0)
if (arr[i][j] < arr[i - 1][j])
continue;
if (j < column - 1)
if (arr[i][j] < arr[i][j + 1])
continue;
if (i < row - 1)
if (arr[i][j] < arr[i + 1][j])
continue;
if (j > 0)
if (arr[i][j] < arr[i][j - 1])
continue;
result.push_back(i);
result.push_back(j);
break;
}
}
return result;
}
int main()
{
vector > arr = { { 9, 8 }, { 2, 6 } };
vector result = findPeakGrid(arr);
cout << "Peak element found at index: " << result[0]
<< ", " << result[1] << endl;
return 0;
}



Efficiently compute sums of diagonals of a matrix
Examples
Input :
4
1 2 3 4
4 3 2 1
7 8 9 6
6 5 4 3
Output :
Principal Diagonal: 16
Secondary Diagonal: 20
Input :
3
1 1 1
1 1 1
1 1 1
Output :
Principal Diagonal: 3
Secondary Diagonal: 3
const int MAX = 100;
void printDiagonalSums(int mat[][MAX], int n)
{
int principal = 0, secondary = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j)
principal += mat[i][j];
if ((i + j) == (n - 1))
secondary += mat[i][j];
}
}
cout << "Principal Diagonal:" << principal << endl;
cout << "Secondary Diagonal:" << secondary << endl;
}
int main()
{
int a[][MAX] = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 },
{ 1, 2, 3, 4 }, { 5, 6, 7, 8 } };
printDiagonalSums(a, 4);
return 0;
}
Tell me about your projects and whether they asked follow-up questions on any of them.
Also, prepare for the following questions
Tip 1:Tell us about an incident where something went wrong in your project while you were managing it.
Tip 2:How do you facilitate an environment of collaboration on your team?
Tip 3: How do you define an ideal project?

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?