graph6 ❗️[LEET CODE] 207. Course Schedule # Problem There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, .. 2021. 4. 10. ❗️[LEET CODE] 332. Reconstruct Itinerary # Problem You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from "JFK", thus, the itinerary must begin with "JFK". If there are multiple valid itineraries, you should return the itinerary that has the smallest lexic.. 2021. 4. 10. [LEET CODE] 78. Subsets # Problem Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Constraints: 1 2021. 4. 9. [LEET CODE] 17. Letter Combinations of a Phone Number # Problem Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. Constraints: 0 List[str]: def dfs(index, path): # 끝까지 탐색하면 백트래킹 if len(path) == len(digits): result.append.. 2021. 4. 7. [LEET CODE] 200. Number of Islands # Problem Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Constraints: m == grid.length n == grid[i].length 1 = len(grid) or \ j = len(grid[.. 2021. 4. 6. [코딩 + 알고리즘 완주반] 19일차. 그래프 이해와 자료구조 # 그래프 실제 세계의 현상이나 사물을 정점( 또는 노드)와 간선으로 표현 # 그래프 관련 용어 노드 (Node) : 정점(Vertex) , 위치 간선 (Edge) : 위치 간의 관계를 표시한 선으로 노드를 연결한 선 (link 또는 branch) 인접 정점 (Adjacent Vertex) : 간선으로 직접 연결된 정점 (또는 노드) 정점의 차수(Degree) : 무방향 그래프에서 하나의 정점에 인접한 정점의 수 진입 차수(In-Degree) : 방향그래프에서 외부에서 오는 간선의 수 진출 차수(Out-Degree) : 방향 그래프에서 외부로 향하는 간선의 수 경로 길이 (Path Length) : 경로를 구성하기 위해 사용된 간선의 수 단순 경로(Simple Path) : 처음 정점과 끝 정점을 제외하.. 2021. 4. 5. 이전 1 다음 반응형