Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions leetcode3/오은혁/1861. Rotating the Box
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution:
def rotateTheBox(self, grid: list[list[str]]) -> list[list[str]]:


for y in range(len(grid))
board=[[] for _ in range(len(grid[0]))]
for y in grid:
for i in range(len(y)):
board[i].append(y[i])


46 changes: 46 additions & 0 deletions leetcode3/오은혁/1914. Cyclically Rotating a Grid
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from collections import deque
class Solution:
def rotate(self,grid,x,y,xn,yn,k):
dq=deque([])
cur_x=x
cur_y=y
while cur_x<x+xn:
dq.append((cur_y,cur_x))
cur_x+=1
cur_x-=1
cur_y+=1
while cur_y<y+yn:
dq.append((cur_y,cur_x))
cur_y+=1
cur_y-=1
cur_x-=1
while cur_x>=x:
dq.append((cur_y,cur_x))
cur_x-=1
cur_x+=1
cur_y-=1
while cur_y>y:
dq.append((cur_y,cur_x))
cur_y-=1
return dq
temp=yn*xn-(yn-2)*(xn-2)
k=k%temp

if k<yn:
sx=x
sy=y+k
elif k>=yn and k<yn+xn-1:
sx=k-yn+1
sy=yn-1

elif k<2*yn+xn-2:
sx=xn-1
sy=k-yn-xn

else:
sx=
sy=y


def rotateGrid(self, grid: List[List[int]], k: int) -> List[List[int]]:
return self.rotate(grid,0,0,len(grid[0]),len(grid),k)
13 changes: 13 additions & 0 deletions leetcode3/오은혁/copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#

'''
1. 아이디어 :


2. 시간복잡도 :
O()

3. 자료구조/알고리즘 :


'''
Loading