[LeetCode] 3394. Check if Grid can be Cut into Sections (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given an integer n representing the dimensions of an n x n grid, with the origin at the bottom-left corner of the grid. You are also given a 2D array of coordinates rectangles, where rectangles[i] is in the form [startx, starty, endx, endy], representing a rectangle on the grid. Each rectangle is defined as follows:(startx, starty): The bottom-left corner of..
[LeetCode] 3169. Count Days Without Meetings (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given a positive integer days representing the total number of days an employee is available for work (starting from day 1). You are also given a 2D array meetings of size n where, meetings[i] = [start_i, end_i] represents the starting and ending days of meeting i (inclusive). Return the count of days when the employee is available for work but no meetings a..
[LeetCode] 1976. Number of Ways to Arrive at Destination (Python)
·
알고리즘/LeetCode
난이도: MediumProblem Description You are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections. The inputs are generated such that you can reach any intersection from any other intersection and that there is at most one road between any two intersections. You are given an integer n and a 2D integer array roads where roads[i] = [ui,..
25.03.21 코딩테스트 대비
·
알고리즘/코딩테스트 대비
BOJ 16236. 아기 상어https://www.acmicpc.net/problem/16236 내 코드import sysfrom collections import dequeinput = sys.stdin.readlinen = int(input())area = []for i in range(n): area.append(list(map(int, input().split()))) for j in range(n): if area[i][j] == 9: start = (i, j) area[i][j] = 0def bfs(start, size): visited = [[0]*n for _ in range(n)] q = deque([start]) ..
25.03.20 코딩테스트 대비
·
알고리즘/코딩테스트 대비
BOJ 11660. 구간 합 구하기 5https://www.acmicpc.net/problem/11660  내 코드import sysinput = sys.stdin.readlinen, m = map(int, input().split())board = [list(map(int, input().split())) for _ in range(n)]for i in range(n): for j in range(n): if i == 0 and j == 0: continue elif j == 0: board[i][j] += board[i-1][-1] else: board[i][j] += board[i][j-1]for ..
[LeetCode] 3108. Minimum Cost Walk in Weighted Graph (Python)
·
알고리즘/LeetCode
난이도: HardProblem DescriptionThere is an undirected weighted graph with n vertices labeled from 0 to n - 1. You are given the integer n and an array edges, where edges[i] = [ui, vi, wi] indicates that there is an edge between vertices ui and vi with a weight of wi. A walk on a graph is a sequence of vertices and edges. The walk starts and ends with a vertex, and each edge connects the vertex that..