Matrix Interview Questions | Practice Problems

Below is the list of commonly asked interview questions that uses matrix data structure-

  1. Print Matrix in Spiral Order
  2. Create Spiral Matrix from given array
  3. Shift all matrix elements by 1 in Spiral Order
  4. Find Shortest path from source to destination in a matrix that satisfies given constraints
  5. Change all elements of row i and column j in a matrix to 0 if cell (i, j) has value 0
  6. Print diagonal elements of the matrix having positive slope
  7. Find all paths from first cell to last cell of a matrix
  8. Replace all occurrences of 0 that are not surrounded by 1 in a binary matrix
  9. In-place rotate the matrix by 90 degrees in clock-wise direction
  10. Count negative elements present in sorted matrix in linear time
  11. Report all occurrences of an element in row wise and column wise sorted matrix in linear time
  12. Calculate sum of all elements in a sub-matrix in constant time
  13. Find maximum sum K x K sub-matrix in a given M x N matrix
  14. Find maximum sum submatrix present in a given matrix
  15. Find probability that a person is alive after taking N steps on the island
  16. Count the number of islands
  17. Flood fill Algorithm
  18. Find shortest safe route in a field with sensors present
  19. Find all occurrences of given string in a character matrix
  20. Shortest path in a Maze | Lee algorithm
  21. Travelling Salesman Problem using Branch and Bound
  22. Collect maximum points in a matrix by satisfying given constraints
  23. Count number of paths in a matrix with given cost to reach destination cell
  24. Find longest sequence formed by adjacent numbers in the matrix
  25. Find the minimum cost to reach last cell of the matrix from its first cell
  26. Matrix Chain Multiplication
  27. Find size of largest square sub-matrix of 1’s present in given binary matrix
  28. Chess Knight Problem – Find Shortest path from source to destination
  29. Find Duplicate rows in a binary matrix
  30. Print all possible solutions to N Queens problem
  31. Print all Possible Knight’s Tours in a chessboard
  32. Find Shortest Path in Maze
  33. Find Longest Possible Route in a Matrix


Thank you for being with us. 🙂


Leave a Reply

Notify of