Tip 1: Practice DSA consistently and focus on understanding patterns (not just solving questions).
Tip 2: Solve problems under time constraints to improve speed and accuracy for coding rounds.
Tip 3: Build and explain projects clearly to strengthen fundamentals and confidence during interviews.
Tip 1: Keep your resume concise (one page) and clearly highlight relevant skills, projects, and achievements.
Tip 2: Mention projects with proper details, including the tech stack and your exact contributions.



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.
Step 1: I first understood the problem and identified that it is a shortest path problem in a grid where movement is allowed in eight directions.
Step 2: I initially considered using DFS but realized it would not guarantee the shortest path and could be inefficient.
Step 3: I then switched to using Breadth-First Search (BFS), since BFS is ideal for finding the shortest path in an unweighted grid.
Step 4: I used a queue to traverse the grid level by level, marking visited cells to avoid revisiting and maintaining the current path length.
Step 5: For each cell, I explored all eight possible directions and added valid cells (within bounds and with value = 0) to the queue.
Step 6: When I reached the bottom-right cell, I returned the current path length as the answer.
Step 7: Finally, I handled edge cases such as when the starting or ending cell is blocked, returning -1 in those cases.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which traversal uses a queue as its primary data structure?