선발대

[스파르타] 99클럽 2기 코테스터디 26일차 TIL / leet 1476 본문

스파르타코딩클럽/활동 내용

[스파르타] 99클럽 2기 코테스터디 26일차 TIL / leet 1476

신선한 스타트 2024. 6. 14. 23:52

LeetCode: 1476. Subrectangle Queries (링크)

 

 

class SubrectangleQueries:

    def __init__(self, rectangle: List[List[int]]):
        self.rectangle = rectangle

    def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None:
        for row in range(row1, row2+1):
	        for col in range(col1, col2+1):
		        self.rectangle[row][col] = newValue

    def getValue(self, row: int, col: int) -> int:
        return self.rectangle[row][col]
        


# Your SubrectangleQueries object will be instantiated and called as such:
# obj = SubrectangleQueries(rectangle)
# obj.updateSubrectangle(row1,col1,row2,col2,newValue)
# param_2 = obj.getValue(row,col)

오늘 미들러 풀이 끝!


참고한 블로그: https://bomoto.tistory.com/21

 

[Python] 리트코드 1476번 : Subrectangle Queries (Array)

https://leetcode.com/problems/subrectangle-queries/ Subrectangle Queries - 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 SubrectangleQueri

bomoto.tistory.com

 

Comments