[프로그래머스] 바탕화면 정리
def solution(wallpaper): left_top = [49,49] right_down = [0,0] row_l, col_l = len(wallpaper), len(wallpaper[0]) area = [[""]*col_l for _ in range(row_l)] for i,row in enumerate(wallpaper): for j,item in enumerate(row): area[i][j] = item if item == "#": left_top[0] = min(left_top[0],i) left_top[1] = min(left_top[1],j) right_down[0] = max(right_down[0],i+1) right_down[1] = max(right_down[1],j+1) r..
2023. 6. 23.
[프로그래머스] 달리기 경주
def solution(players, callings): # {'mumu': 0, 'soe': 1, 'poe': 2, 'kai': 3, 'mine': 4} player_dict = {player:rank for rank,player in enumerate(players)} # {0: 'mumu', 1: 'soe', 2: 'poe', 3: 'kai', 4: 'mine'} rank_dict = {rank:player for rank,player in enumerate(players)} for call in callings: call_index = player_dict[call] prev_index = call_index -1 player_dict[rank_dict[call_index]], player_di..
2023. 6. 23.