본문 바로가기
반응형

Study86

[LeetCode] #743. Network Delay Time (python) 문제 https://leetcode.com/problems/network-delay-time/ Network Delay Time - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com n개의 노드가 있는 네트워크가 있다. (출발지, 목적지, 소요 시간)이 주어진다. 주어진 노드 k에서 신호를 보낼 때 모든 n개의 노드에 신호를 보낼 때 걸리는 시간을 반환해야한다. 만약 모든 노드로 신호를 보내는 것이 불가능하면 -1을 반환하면 된다. 예시 입출력 Input: time.. 2022. 3. 23.
[LeetCode] #207. Course Schedule (python) 문제 https://leetcode.com/problems/course-schedule/ Course Schedule - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com [a, b] 형식으로 구성된 a를 끝내려면 b를 먼저 끝내야 된다는 코스 리스트가 있다. 코스 개수 n도 함께 입력 받는다. 주어진 모든 코스를 완료 가능하다면 True를 반환하고 그렇지 않으면 False를 반환해야 한다. 예시 입출력 Input: numCourses = 2, prerequisit.. 2022. 3. 17.
[LeetCode] #78. Subsets (python) 문제 https://leetcode.com/problems/subsets/ Subsets - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 모든 부분집합을 반환해야 한다. 예시 입출력 Input: nums = [1,2,3] Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] 풀이 내 풀이 class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: outpu.. 2022. 3. 17.
[LeetCode] #39. Combination Sum (python) 문제 https://leetcode.com/problems/combination-sum/ Combination Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 숫자 집합 candidates의 원소들을 조합해서 합한 값이 target이 되는 조합들을 반환해야 한다. 원소들은 중복 사용이 가능하다. 예시 입출력 Input: candidates = [2,3,6,7], target = 7 Output: [[2,2,3],[7]] 풀이 내 풀이 class Solu.. 2022. 3. 17.
반응형