Skip to main content

6 docs tagged with "Matrix"

View all tags

2D Prefix Sum

Extend the Prefix Sum technique to two dimensions — efficiently answer rectangular range sum queries on a 2D grid in O(1) after O(m×n) preprocessing. Includes intuition, dry runs, and multi-language implementations.

Beautiful Subgrids Problem - Efficient Detection

In this post, we'll explore the Beautiful Subgrids problem, an algorithmic challenge that focuses on efficiently detecting subgrids in a matrix that meet specific criteria. We'll delve into the problem's constraints, discuss the approach for finding beautiful subgrids, and provide solutions in multiple languages such as C++, Java, Python, JavaScript, and Go. By the end, you'll understand how to count beautiful subgrids in a grid efficiently.

Binary Search in Matrix

In this blog post, we'll explore binary search in a matrix, an optimized method to find an element in a sorted 2D matrix efficiently in C++.

matrix-ds

One more of the basic Data Structure is Matrix Data structure and we'll know more about it.

matrix-ds

One more of the basic Data Structure is Matrix Data structure and we'll know more about it.

Word Search

Solve the Word Search problem using DFS with backtracking on a 2D character grid. Covers both Word Search I (single word) and Word Search II (multiple words with Trie).