Tip 1 : Practice DSA questions as much as u can
Tip 2 : Focus on Graphs and Dynamic Programming more
Tip 3 : Make good Resume
Tip 1 : Single Page Resume
Tip 2 : Add your previous Experiences and good projects.
The round was conducted on hackerrank, we were given 3 coding questions and 90 minutes to solve the questions were on the tougher side.All questions were based on graphs and tries.Also all 3 questions were inter Related.I hardly remember the last one so i mentioned 2 of them here.



1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.
2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).
2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.




1. It is guaranteed that the given graph is DAG.
2. There will be no multiple edges and self-loops in the given DAG.
3. There can be multiple correct solutions, you can find any one of them.
4. Don’t print anything, just return an array representing the topological sort of the vertices of the given DAG.
In this round first 5 mins went into an introduction and the interviewer explaining me about the interview process.
Then I was given 15 mins to solve 3-time complexity questions, after it, next 40 mins the interviewer told me that try to solve as many questions as possible, the focus more on the correctness of the solution rather than the optimal solution.
A code was given, which was essentially counting the sum of the digits of the number.
We need to tell the time complexity for it.
Tip 1 : the complexity should be O(no of digits) which is essentially logn
Let's assume there are two functions one whose complexity was (N + M) and the other whose complexity was N*logM we need to tell which has lower complexity and also in what scenarios the function having lower complexity will take more time.
Tip 1 : Need to have a good knowledge of Asymptotic notations and time complexity.
Given a file having n lines and every line has a different number of characters written, if we want to find the middle line can we calculate the sum of bytes of all characters in the file and divide it by n ? will that position will always be somewhere in the middle line ???
Tip 1 : The answer would be no because it might happen some lines have a huge number of characters and some lines have very few characters so the average would not always result somewhere in the middle line.


Input: [[2,1,1],[1,1,0],[0,0,0]]
Output: 2
At T=0, only orange at (0,0) is rotten.
At T=1, oranges at (0,0),(0,1) and (1,0) are rotten.
At T=2, oranges at (0,0),(0,1),(1,0),(0,2) and (1,1) are rotten.
No fresh oranges are left after T=2.
solved using BFS



solved using DFS



1. Coordinates of the cells are given in 0-based indexing.
2. You can move in 4 directions (Up, Down, Left, Right) from a cell.
3. The length of the path is the number of 1s lying in the path.
4. The source cell is always filled with 1.
1 0 1
1 1 1
1 1 1
For the given binary matrix and source cell(0,0) and destination cell(0,2). Few valid paths consisting of only 1s are
X 0 X X 0 X
X X X X 1 X
1 1 1 X X X
The length of the shortest path is 5.
Since this was the third question interviewer was not expecting me to code the solution, he just wanted me to explain my solution by dry running it on test cases.
My solution was based on BFS.

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