99클럽 코테 스터디 35일차 TIL, 프로그래머스 / 퍼즐 조각 채우기
🔑 오늘의 학습 키워드 BFS, 구현🔗 문제링크 https://school.programmers.co.kr/learn/courses/30/lessons/84021 from collections import dequedef solution(game_board, table): answer = 0 n = len(game_board) directions = [(1, 0), (0, 1), (-1, 0), (0, -1)] def in_range(x, y): return 0 🗒️ 공부한 내용 본인의 언어로 정리하기🤔 문제를 보고 든 생각문제가 요구하는 사항이 많아서 함수단위로 우선 작성을 한다음 코드 세부 구현을 해야겠다고 생각했다.1. BFS로 구멍이랑 블록을 구분하는 함..
99클럽 코테 스터디 32일차 TIL, 프로그래머스 / 아이템 줍기
🔑 오늘의 학습 키워드 : bfs, 좌표 표현🔗 문제링크 https://school.programmers.co.kr/learn/courses/30/lessons/87694 from collections import dequedef solution(rectangle, characterX, characterY, itemX, itemY): answer = 0 grid = [[0] * 101 for _ in range (101)] for x1,y1,x2,y2 in rectangle : x1, y1, x2, y2 = x1 * 2, y1 * 2, x2 * 2, y2 * 2 for i in range (x1,x2+1): for j in range..
99클럽 코테 스터디 30일차 TIL, leetcode / Minimum Operations to Make a Subsequence
🔑 오늘의 학습 키워드 : 이분탐색🔗 문제링크 https://leetcode.com/problems/minimum-operations-to-make-a-subsequence/ '''이분 탐색을 사용하려면 우선 정렬된 리스트가 필요함이 경우, 정렬을 한 리스트를 사용하면 안됨target 리스트는 중복 없는 리스트 -> 고유의 값을 가진다면 -> 인덱스 역할을 할 수 있는 애 아닐까?target = [6,4,8,1,3,2], arr = [4,7,6,2,3,8,6,1]target = [1,2,3,4,5,6], arr = [2,x,1,6,5,3,1,4]이렇게 생각해보니? 가장 증가하는 길이가 긴 수열을 구하는 것을 구한 다음전체 length에서 가장 길이가 긴 수열의 길이만큼을 뺴면 되지 않을까?가장 증가하..
99클럽 코테 스터디 29일차 TIL, leet code / Maximum Profit in Job Scheduling
🔑 오늘의 학습 키워드 dp, binary search🔗 문제링크 https://leetcode.com/problems/maximum-profit-in-job-scheduling/submissions/1360938614/ class Solution: def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int: tasks = [(s,e,p) for s,e,p in zip(startTime,endTime,profit)] tasks.sort(key = lambda x : x[1]) dp = [(0, 0)] # (end_time, max_profit) ..