Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Interview Problems on Matrix
  • Practice Matrix
  • MCQs on Matrix
  • Tutorial on Matrix
  • Matrix Traversal
  • Sorting in Matrix
  • Matrix Rotation
  • Transpose of Matrix
  • Inverse of Matrix
  • Determinant of Matrix
  • Matrix Application
  • Adjoint & Inverse Matrix
  • Sparse Matrix
  • Matrix Exponentiation
Open In App
Next Article:
Coding Problems on Matrix Data Structure
Next article icon

Coding Problems on Matrix Data Structure

Last Updated : 23 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Matrix are a fundamental data structure with vast applications in computer science. This article will explore a variety of coding problems that uses the matrix data structure. Through these hands-on exercises, readers will develop practical skills in matrix manipulation and algorithm implementation. From basic operations to more advanced matrix-based techniques, this collection of problems aims to build the reader's expertise in working with this powerful data structure.

Practice Problems on the Matrix Data Structure:

  • Rotate Matrix Elements
  • Inplace rotate square matrix by 90 degrees | Set 1
  • Rotate a matrix by 90 degree without using any extra space | Set 2
  • Rotate a Matrix by 180 degree
  • Rotate each ring of matrix anticlockwise by K elements
  • Turn an image by 90 degree
  • Check if all rows of a matrix are circular rotations of each other
  • Sort the given matrix
  • Find the row with maximum number of 1s
  • Find median in row wise sorted matrix
  • Matrix Multiplication | Recursive
  • Program to multiply two matrices
  • Program for scalar multiplication of a matrix
  • Program to print Lower triangular and Upper triangular matrix of an array
  • Find distinct elements common to all rows of a matrix
  • Print a given matrix in spiral form
  • Find maximum element of each row in a matrix
  • Find unique elements in a matrix
  • Shift matrix elements row-wise by k
  • Different Operations on Matrices
  • Print a given matrix in counter-clock wise spiral form
  • Swap major and minor diagonals of a square matrix
  • Maximum path sum in matrix
  • Squares of Matrix Diagonal Elements
  • Move matrix elements in given direction and add elements with same value
  • Sorting rows of matrix in ascending order followed by columns in descending order
  • Sum of middle row and column in Matrix
  • Row-wise vs column-wise traversal of matrix
  • Rotate the matrix right by K times
  • Program to check idempotent matrix
  • Program to check Involutory Matrix
  • Interchange elements of first and last rows in matrix
  • Print matrix in zag-zag fashion
  • Row wise sorting in 2D array
  • Program for Markov matrix
  • Program to check diagonal matrix and scalar matrix
  • Sort the matrix row-wise and column-wise
  • Find the number of islands
  • Magic Square | Even Order
  • Magic Square
  • Check given matrix is magic square or not
  • Check given matrix is magic square or not
  • Kronecker Product of two matrices
  • Count sub-matrices having sum divisible ‘k’
  • Diagonally Dominant Matrix
  • Minimum operations required to make each row and column of matrix equals
  • Count frequency of k in a matrix of size n where matrix(i, j) = i+j
  • Given 1’s, 2’s, 3’s ……k’s print them in zig zag way.
  • Number of cells a queen can move with obstacles on the chessborad
  • Maximum product of 4 adjacent elements in matrix
  • Minimum flip required to make Binary Matrix symmetric
  • Program to check if matrix is lower triangular
  • Program to check if matrix is upper triangular
  • Frequencies of even and odd numbers in a matrix
  • Center element of matrix equals sums of half diagonals
  • Program for Identity Matrix
  • Program to swap upper diagonal elements with lower diagonal elements of matrix.
  • Sparse Matrix Representations
  • Ways of filling matrix such that product of all rows and all columns are equal to unity
  • Mirror of matrix across diagonal
  • Find if there is a rectangle in binary matrix with corners as 1
  • Find all rectangles filled with 0
  • Shortest distance between two cells in a matrix or grid
  • Counting sets of 1s and 0s in a binary matrix
  • Search in a row wise and column wise sorted matrix
  • Create a matrix with alternating rectangles of O and X
  • Zigzag (or diagonal) traversal of Matrix
  • Inplace (Fixed space) M x N size matrix transpose | Updated
  • Minimum cost to sort a matrix of numbers from 0 to n^2 – 1
  • Unique cells in a binary matrix
  • Count entries equal to x in a special matrix
  • Check if a given matrix is sparse or not
  • Row-wise common elements in two diagonals of a square matrix
  • Check if sums of i-th row and i-th column are same in matrix
  • Find row number of a binary matrix having maximum number of 1s
  • Program to check if a matrix is symmetric
  • Find if a 2-D array is completely traversed or not by following the cell values
  • Program to Print Matrix in Z form
  • Print all palindromic paths from top left to bottom right in a matrix
  • Possible moves of knight
  • Efficiently compute sums of diagonals of a matrix
  • Boundary elements of a Matrix
  • Print a matrix in a spiral form starting from a point
  • Print matrix in snake pattern
  • Program to Interchange Diagonals of Matrix
  • Find difference between sums of two diagonals
  • Construct Ancestor Matrix from a Given Binary Tree
  • Construct tree from ancestor matrix
  • Circular Matrix (Construct a matrix with numbers 1 to m*n in spiral way)
  • Program for Sudoku Generator
  • Program for Conway’s Game Of Life
  • Maximum sum of hour glass in matrix
  • Maximum and Minimum in a square matrix.
  • Print matrix in antispiral form
  • Program to find Normal and Trace of a matrix
  • Sort a Matrix in all way increasing order
  • Minimum operations required to set all elements of binary matrix
  • Print a given matrix in reverse spiral form
  • C Program To Check whether Matrix is Skew Symmetric or not
  • Sum of matrix element where each elements is integer division of row and column
  • Sparse Matrix and its representations
  • Find number of transformation to make two Matrix Equal
  • Form coils in a matrix
  • Sum of matrix in which each element is absolute difference of its row and column numbers
  • Check horizontal and vertical symmetry in binary matrix
  • Maximum determinant of a matrix with every values either 0 or n
  • Sum of both diagonals of a spiral odd-order square matrix
  • Find pair of rows in a binary matrix that has maximum bit difference
  • Find all permuted rows of a given row in a matrix
  • Find perimeter of shapes formed with 1s in binary matrix
  • Print cells with same rectangular sums in a matrix
  • Print matrix in diagonal pattern
  • Maximum difference of sum of elements in two rows in a matrix
  • Find pairs with given sum such that elements of pair are in different rows
  • Total coverage of all zeros in a binary matrix
  • Replace every matrix element with maximum of GCD of row or column
  • Count all sorted rows in a matrix
  • Queries in a Matrix
  • Maximum XOR value in matrix
  • Maximum mirrors which can transfer light from bottom to right
  • Direction at last square block
  • Print K’th element in spiral form of matrix
  • Find if given matrix is Toeplitz or not
  • Count zeros in a row wise and column wise sorted matrix
  • Count Negative Numbers in a Column-Wise and Row-Wise Sorted Matrix
  • Find size of the largest ‘+’ formed by all ones in a binary matrix
  • Return previous element in an expanding matrix
  • Print n x n spiral matrix using O(1) extra space
  • Shortest path in a Binary Maze
  • Find orientation of a pattern in a matrix
  • Find a specific pair in Matrix
  • Print maximum sum square sub-matrix of given size
  • Common elements in all rows of a given matrix
  • In-place convert matrix in specific order
  • A Boolean Matrix Question
  • Given a Boolean Matrix, find k such that all elements in k’th row are 0 and k’th column are 1.
  • Print unique rows in a given boolean matrix
  • Find the largest rectangle of 1’s with swapping of columns allowed
  • Validity of a given Tic-Tac-Toe board configuration
  • Submatrix Sum Queries
  • Program for Rank of Matrix
  • Maximum size rectangle binary sub-matrix with all 1s
  • Maximum size square sub-matrix with all 1s
  • Find sum of all elements in a matrix except the elements in row and/or column of given cell?
  • Count number of islands where every island is row-wise and column-wise separated
  • Find a common element in all rows of a given row-wise sorted matrix
  • Given a matrix of ‘O’ and ‘X’, replace ‘O’ with ‘X’ if surrounded by ‘X’
  • Given a matrix of ‘O’ and ‘X’, find the largest subsquare surrounded by ‘X’
  • Flood fill Algorithm – how to implement fill() in paint?
  • Print all elements in sorted order from row and column wise sorted matrix
  • Given an n x n square matrix, find sum of all sub-squares of size k x k
  • Program to find transpose of a matrix
  • C program for addition of two matrices
  • C program for subtraction of matrices
  • Collect maximum points in a grid using two traversals
  • Collect maximum coins before hitting a dead end
  • Number of paths with exactly k coins
  • Find length of the longest consecutive path from a given starting character
  • Find the longest path in a matrix with given constraints
  • Minimum Initial Points to Reach Destination
  • Divide and Conquer | Set 5 (Strassen’s Matrix Multiplication)
  • Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)

Quick Links :

  • 'Practice Problems' on Arrays
  • 'Quizzes' on Arrays
  • 'Video Tutorials' on Arrays

Next Article
Coding Problems on Matrix Data Structure

H

harendrakumar123
Improve
Article Tags :
  • Matrix
  • DSA
Practice Tags :
  • Matrix

Similar Reads

    Matrix Data Structure
    Matrix Data Structure is a two-dimensional array arranged in rows and columns. It is commonly used to represent mathematical matrices and is fundamental in various fields like mathematics, computer graphics, and data processing. Matrices allow for efficient storage and manipulation of data in a stru
    2 min read
    10 Most Important Data Structures For Coding Interviews
    Data structures are important for proficient and effective programming. In coding interviews, familiarity with common data structures and their operations is very important for solving problems efficiently and quickly. In this article, we will see the ten most critical data structures for coding int
    5 min read
    Top 50 Problems on Matrix/Grid Data Structure asked in SDE Interviews
    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 list of the top 50 frequently asked interview questions on Matrix/Grid in the SDE Interviews. Problems in this Article are divided into
    2 min read
    Commonly Asked Data Structure Interview Questions on Matrix
    A Matrix can be considered as array of arrays or 2D array. We use matrix data structure to store two dimensional data.Top Coding Interview Questions on MatrixThe following list of top coding problems on Matrix covers a range of difficulty levels, from easy to hard, to help candidates prepare for int
    4 min read
    Common operations on various Data Structures
    Data Structure is the way of storing data in computer's memory so that it can be used easily and efficiently. There are different data-structures used for the storage of data. It can also be defined as a mathematical or logical model of a particular organization of data items. The representation of
    15+ min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences