Tip 1: Practice makes a man perfect, so keep practicing rather than dreaming or imagining.
Tip 2: Theoretical topics should be picked just before the interviews, i.e., at the end of your preparation journey.
Tip 3: Keep participating in contests on competitive programming platforms. Never cheat yourself while preparing.
Tip 1: Don’t fake anything, because most interviewers will open your CV in front of you and iterate over all the topics.
Tip 2: Don’t make any blunders, such as spelling or grammar mistakes. There are many tools available, so it’s expected that you don’t make mistakes here.
Tip 3: Keep it to a single page.
Tip 4: Never create your CV in one go; keep iterating and fine-tuning it until it's final.
This round didn’t have any MCQs; there were only 3 CP questions.



Consider below matrix of characters,
[ 'D', 'E', 'X', 'X', 'X' ]
[ 'X', 'O', 'E', 'X', 'E' ]
[ 'D', 'D', 'C', 'O', 'D' ]
[ 'E', 'X', 'E', 'D', 'X' ]
[ 'C', 'X', 'X', 'E', 'X' ]
If the given string is "CODE", below are all its occurrences in the matrix:
'C'(2, 2) 'O'(1, 1) 'D'(0, 0) 'E'(0, 1)
'C'(2, 2) 'O'(1, 1) 'D'(2, 0) 'E'(3, 0)
'C'(2, 2) 'O'(1, 1) 'D'(2, 1) 'E'(1, 2)
'C'(2, 2) 'O'(1, 1) 'D'(2, 1) 'E'(3, 0)
'C'(2, 2) 'O'(1, 1) 'D'(2, 1) 'E'(3, 2)
'C'(2, 2) 'O'(2, 3) 'D'(2, 4) 'E'(1, 4)
'C'(2, 2) 'O'(2, 3) 'D'(3, 3) 'E'(3, 2)
'C'(2, 2) 'O'(2, 3) 'D'(3, 3) 'E'(4, 3)
Solve using the KMP algorithm.



Input: ‘S’ =’badam’
Output: ‘ada’
‘ada’ is the longest palindromic substring, and it can be proved that it is the longest possible palindromic substring.
Solve using dynamic programming.



Input:
4 5
0 1 5
0 2 8
1 2 9
1 3 2
2 3 6

In the given input, the number of vertices is 4, and the number of edges is 5.
In the input, following the number of vertices and edges, three numbers are given. The first number denotes node ‘X’, the second number denotes node ‘Y’ and the third number denotes the distance between node ‘X’ and ‘Y’.
As per the input, there is an edge between node 0 and node 1 and the distance between them is 5.
The vertices 0 and 2 have an edge between them and the distance between them is 8.
The vertices 1 and 2 have an edge between them and the distance between them is 9.
The vertices 1 and 3 have an edge between them and the distance between them is 2.
The vertices 2 and 3 have an edge between them and the distance between them is 6.
1. There are no self-loops(an edge connecting the vertex to itself) in the given graph.
2. There can be parallel edges i.e. two vertices can be directly connected by more than 1 edge.
This was a typical DSA round.



1. If ‘k’ is not present in 'arr', then print -1.
2. There are no duplicate elements present in 'arr'.
3. 'arr' can be rotated only in the right direction.
Input: 'arr' = [12, 15, 18, 2, 4] , 'k' = 2
Output: 3
Explanation:
If 'arr' = [12, 15, 18, 2, 4] and 'k' = 2, then the position at which 'k' is present in the array is 3 (0-indexed).
Solve using binary search.



A binary search tree is a binary tree data structure, with the following properties :
a. The left subtree of any node contains nodes with a value less than the node’s value.
b. The right subtree of any node contains nodes with a value equal to or greater than the node’s value.
c. Right, and left subtrees are also binary search trees.
It is guaranteed that,
d. All nodes in the given tree are distinct positive integers.
e. The given BST does not contain any node with a given integer value.


First of all, you should be aware of the binary search tree. The elements in the left subtree will always be less than the value of the root node, while the right subtree will have elements greater than the value at the root node. So, while inserting or deleting, you will have to maintain this structure. Given that the tree maintains this specific structure, searching becomes easy.
Single question was asked by hiring manager.



For a (6 x 6) board, the numbers are written as follows:

You start from square 1 of the board (which is always in the last row and first column). On each square say 'X', you can throw a dice which can have six outcomes and you have total control over the outcome of dice throw and you want to find out the minimum number of throws required to reach the last cell.
Some of the squares contain Snakes and Ladders, and these are possibilities of a throw at square 'X':
You choose a destination square 'S' with number 'X+1', 'X+2', 'X+3', 'X+4', 'X+5', or 'X+6', provided this number is <= N*N.
If 'S' has a snake or ladder, you move to the destination of that snake or ladder. Otherwise, you move to S.
A board square on row 'i' and column 'j' has a "Snake or Ladder" if board[i][j] != -1. The destination of that snake or ladder is board[i][j].
You can only take a snake or ladder at most once per move: if the destination to a snake or ladder is the start of another snake or ladder, you do not continue moving - you have to ignore the snake or ladder present on that square.
For example, if the board is:
-1 1 -1
-1 -1 9
-1 4 -1
Let's say on the first move your destination square is 2 [at row 2, column 1], then you finish your first move at 4 [at row 1, column 2] because you do not continue moving to 9 [at row 0, column 0] by taking the ladder from 4.
A square can also have a Snake or Ladder which will end at the same cell.
For example, if the board is:
-1 3 -1
-1 5 -1
-1 -1 9
Here we can see Snake/Ladder on square 5 [at row 1, column 1] will end on the same square 5.
Since the dice has values from 1 to 6, in one step you can jump only up to 6. So, basically, imagine it as a graph where, from the current value, there are forward edges to the subsequent 6 elements. The snake's positions can be considered as backward edges, and ladders can be considered as forward edges. So, now the problem boils down to finding the shortest path from start to end, given the graph. Solve it using breadth-first search.

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