(Python/LV1)바탕화면 정리
문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/161990 풀이: def solution(wallpaper): n, m = len(wallpaper), len(wallpaper[0]) s_x, s_y, l_x, l_y = 51, 51, 0, 0 for i in range(n): for j in range(m): if wallpaper[i][j] == "#": s_x = min(s_x, i) s_y = min(s_y, j) l_x = max(l_x, i) l_y = max(l_y, j) return s_x,s_y,l_x + 1,l_y + 1
2023. 3. 2.
(Python/LV1)카드뭉치
문제 출처: https://school.programmers.co.kr/learn/courses/30/lessons/159994?language=python3 풀이: def solution(cards1, cards2, goal): for x in goal: print(x) if len(cards1)>0 and cards1[0] == x: cards1.pop(0) elif len(cards2) > 0 and cards2[0] == x: cards2.pop(0) else: return "x" return "yes" print(solution(["i", "drink", "water"], ["want", "to"], ["i", "want", "to", "drink", "water"])) # print(solut..
2023. 2. 18.