문제 Given a 2D matrix matrix, handle multiple queries of the following type: Calculate the sum of the elements of matrix inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). Implement the NumMatrix class: NumMatrix(int[][] matrix) Initializes the object with the integer matrix matrix. int sumRegion(int row1, int col1, int row2, int col2) Returns ..
문제 https://leetcode.com/problems/spiral-matrix/submissions/ Spiral Matrix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Given an m x n matrix, return all elements of the matrix in spiral order. m x n 행렬이 주어지면 행렬의 모든 요소를 나선형 순서로 반환합니다. 예시 Example 1: Input: matrix = [[1,2,3],[4,5..
문제 Given two n x n binary matrices mat and target, return true if it is possible to make mat equal to target by rotating mat in 90-degree increments, or false otherwise. 두 개의 n x n 이진 행렬 매트와 타겟이 주어지면 매트를 90도 단위로 회전시켜 표적으로 동일하게 만들 수 있으면 true를 반환하고 그렇지 않으면 false를 반환합니다. 예시 Example 1: Input: mat = [[0,1],[1,0]], target = [[1,0],[0,1]] Output: true Explanation: We can rotate mat 90 degrees clockwise..
문제 You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. 이미지를 나타내는 n x n 2D 매트릭스가 제공되면 이미지를 90도(시계 방향) 회전합니다. 이미지는 제자리에서 회전해야 합니다. 즉, 입력 2D 매트릭스를 직접 수정해야 합니다. 다른 2D 매트릭스를 할당하지 않고 회전을 수행합니다. 예시 Exam..
문제 You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. 고객이 은행 에 가지고 있는 금액은 m x n정수 그리드 accounts가 ..
문제 Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. 예시 Example 1: Input: mat = [[0,0,0],[0,1,0],[0,0,0]] Output: [[0,0,0],[0,1,0],[0,0,0]] Example 2: Input: mat = [[0,0,0],[0,1,0],[1,1,1]] Output: [[0,0,0],[0,1,0],[1,2,1]] 제약 조건 Constraints: m == mat.length n == mat[i].length 1
Comment