LeetCode ๐Ÿ”๏ธ/Matrix

LeetCode ๐Ÿ”๏ธ/Matrix

79. Word Search

Description: We should go through every single matrix using Brute Force, backtracking, backtracking with recursively. Solution: We should go through the whole matrix. It is gonna be brute force search. This method makes the function dfs to make a path to search whole matrix. We have a materials length of Matrix(M, N), and the set of path to store our path in the matrix. Let's see the dfs functio..

LeetCode ๐Ÿ”๏ธ/Matrix

48. Rotate Image

Description: As we read the description of problem, we can't make another matrix for output. That means we can change the image without making matrix. Solution: We set left+=1 and right-=1, but it is out of for loop!, so that means we should change the left and top in person. The "i" means that how much apart from the beginning or the end of matrix. In example 1, after we change the value by the..

LeetCode ๐Ÿ”๏ธ/Matrix

54. Spiral Matrix

Decription: We are gonna make the variable name "Top, bottom, right_col, left_col to point the row and column you are currently in. Solution: We set the top and bottom to point to the first row and the last row. Next, we set left_column and right_column to point to the first column and the last column. We can see the sprial matrix gets value following this order: top row --> right most column --..

LeetCode ๐Ÿ”๏ธ/Matrix

73. Set Matrix Zeroes

Description: In the m * n matrix, there are serveral values. If the value is 0, than we should change the entire row value and column value as "0". Before we do actual coding, let's think about the solution we can easily think. If we should check the entire matrix by brute force or whatever. It's gonna have O(mn) time solution. If we make another matrix, and revise the value, then it is gonna ha..

KB0129
'LeetCode ๐Ÿ”๏ธ/Matrix' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก