Skip to content
Home » Matrix

Matrix

Leetcode 48 Rotate Image

This is an interesting problem which looks complex but essentially there are just 2 steps we need to do this. Solution Javascript: Time Complexity:O(n^2) since we visited all the cells in the matrix Space Complexity:O(1) since it’s in place

Leetcode 54 Spiral Matrix

This is indeed a very interesting problem. If we simulate the process, there are a couple of key points to notice: Solution Javascript: Time Complexity:O(m*n) since we visited all the cells in the matrix Space Complexity:O(1)

Leetcode 36. Valid Sudoku

Problem Statement Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Note: Examples Constraints Solution Python: Java: