Open In App

Top 50 Problems on Matrix/Grid Data Structure asked in SDE Interviews

Last Updated : 10 Jul, 2023
Like Article

A Matrix/Grid is a two-dimensional array that consists of rows and columns. It is an arrangement of elements in horizontal or vertical lines of entries. Here is the collection of the Top 50 list of frequently asked interviews question on Matrix/Grid in the SDE Interviews. Problems in this Article are divided into three Levels so that readers can practice according to the difficulty level step by step. 

To learn more about Matrix, please refer to the Tutorial on Matrix/Grid.


Given below are the most frequently asked interview questions on Matrix:

Easy Level Problems on Matrix/Grid Data Structure

Rotate Matrix Elements
Sort the given matrix
Turn an image by 90-degree
Program to multiply two matrices
Find maximum element of each row in a matrix
Count all sorted rows in a matrix
Common elements in all rows of a given matrix
Print matrix in snake pattern
Sort a Matrix in all way increasing order
Find the row with maximum number of 1s
Efficiently compute sums of diagonals of a matrix
Find whether an array is subset of another array
Boundary elements of a Matrix
Check given matrix is magic square or not
Medium Level Problems on Matrix/Grid Data Structure
Search in a row-wise and column-wise sorted 2D array
Find Peak Element in 2D matrix
Matrix Median
Rotate a matrix by 90 degree without using any extra space 
Rotate a Matrix by 180 degree
Rotate the matrix right by K times
Print a given matrix in spiral form
Zigzag (or diagonal) traversal of Matrix
Spiral Traversal of Matrix
Search in a Row-wise and Column-wise Sorted Matrix
Find the number of islands
Boolean Matrix Question
Count number of islands in a binary matrix
Maximum sum rectangle in a 2D matrix
Flood Fill Algorithm
Count all possible paths from top left to bottom right of a m x n matrix
Find the maximum sum path in a matrix
Rotate a matrix by 90 degrees
Minimum steps to reach target by a Knight
Minimum cost to fill given weight in a bag
Shortest path in a Binary Maze
Hard Level Problems on Matrix/Grid Data Structure
Maximum size rectangle binary sub-matrix with all 1s
Find the largest rectangular area possible in a given histogram
Find a specific pair in matrix
Maximum size square sub-matrix with all 1s
Find the largest rectangle of 1’s with swapping of columns allowed
Maximum sum rectangular submatrix in a given matrix
Minimum Initial Points to Reach Destination
Count number of paths with at-most k turns
A Boolean Matrix Question
Matrix Chain Multiplication
Maximum size rectangle binary sub-matrix with all 1s
Construct Ancestor Matrix from a Given Binary Tree
Print K’th element in spiral form of matrix
Find size of the largest ‘+’ formed by all ones in a binary matrix
Print maximum sum square sub-matrix of given size
Validity of a given Tic-Tac-Toe board configuration

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads