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. In-place rotate the matrix by 180 degrees
  11. Count negative elements present in sorted matrix in linear time
  12. Report all occurrences of an element in row wise and column wise sorted matrix in linear time
  13. Calculate sum of all elements in a sub-matrix in constant time
  14. Find maximum sum K x K sub-matrix in a given M x N matrix
  15. Find maximum sum submatrix present in a given matrix
  16. Find probability that a person is alive after taking N steps on the island
  17. Count the number of islands
  18. Flood fill Algorithm
  19. Find shortest safe route in a field with sensors present
  20. Find all occurrences of given string in a character matrix
  21. Shortest path in a Maze | Lee algorithm
  22. Travelling Salesman Problem using Branch and Bound
  23. Collect maximum points in a matrix by satisfying given constraints
  24. Count number of paths in a matrix with given cost to reach destination cell
  25. Find longest sequence formed by adjacent numbers in the matrix
  26. Find the minimum cost to reach last cell of the matrix from its first cell
  27. Matrix Chain Multiplication
  28. Find size of largest square sub-matrix of 1’s present in given binary matrix
  29. Chess Knight Problem – Find Shortest path from source to destination
  30. Find Duplicate rows in a binary matrix
  31. Print all possible solutions to N Queens problem
  32. Print all Possible Knight’s Tours in a chessboard
  33. Find Shortest Path in Maze
  34. Find Longest Possible Route in a Matrix
  35. Fill Binary Matrix with Alternating Rectangles of 0 and 1
  36. Check if given matrix is Toeplitz matrix or not
  37. Calculate size of the largest plus of 1’s in binary matrix


Thank you for being with us. 🙂


Get great deals at Amazon

Leave a Reply

Notify of