Foundations
Linear Structures
Hashing
Array and String Patterns
Recursion, Search, and Sorting
Problem Solving Patterns
Algorithm Searching
Sorting Algorithms
Array Algorithms
Grid Algorithms
Linear Structure Algorithms
Hashing Algorithms
Recursion and Backtracking
Greedy Algorithms
Tree and Heap Algorithms
Graph Algorithms
Dynamic Programming Algorithms
String Algorithms
Math Algorithms
Keyboard ready
Space plays. Arrow keys step. R restarts.
LAB Matrices and Grids Lab
Linear Data Structures
Concept shape
Core
0
1
2
3
4
5
Definition
A matrix is a two-dimensional array, commonly used for grids, maps, tables, and DP states.
Step 1 / 5
Concept shape
Linear Data Structures Core
Matrices and Grids
Welcome to the Matrices and Grids concept lab. A matrix is a two-dimensional array, commonly used for grids, maps, tables, and DP states. The must know points are: Use row and column indexes. Neighbors often mean up, down, left, and right. Bounds checks matter on every move. The common operations are: read cell O(1), scan all cells O(rows * cols), visit neighbors O(1). The complexity shape is Full scan O(R*C). Watch out for these pitfalls: Swapping row and column. Missing boundary checks. Revisiting cells without a seen marker. Related algorithms include BFS, DFS, Dynamic Programming.
Concept details
A matrix is a two-dimensional array, commonly used for grids, maps, tables, and DP states.
Must know
- Use row and column indexes.
- Neighbors often mean up, down, left, and right.
- Bounds checks matter on every move.
Complexity
Full scan O(R*C)
1.0x