Zero to Hero
article thumbnail
1008. Construct Binary Search Tree from Preorder Traversal
Algorithm 2021. 8. 16. 16:57

Construct Binary Search Tree from Preorder Traversal - 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 이진 탐색 트리의 전위 순회 결과가 list로 주어진다. 이를 이용해 이진 탐색 트리를 복원하는 문제다. 1. DFS from typing import * from collections import deque class Solution: def bstFromPreorder(self, preorder: List[int])..

article thumbnail
2021번: 최소 환승 경로
Algorithm 2021. 8. 15. 17:16

2021번: 최소 환승 경로 첫째 줄에 역의 개수 N(1≤N≤100,000), 노선의 개수 L(1≤L≤100,000)이 주어진다. 다음 L개의 줄에는 각 노선이 지나는 역이 순서대로 주어지며 각 줄의 마지막에는 -1이 주어진다. 마지막 줄에는 출발 www.acmicpc.net import sys from collections import deque, defaultdict r = sys.stdin.readline node_num, flag_num = map(int, r().split()) graph = defaultdict(set) for i in range(1, flag_num + 1): temp = list(map(int, r().split())) temp.pop() for node in temp: g..

article thumbnail
797. All Paths From Source to Target
Algorithm 2021. 8. 15. 15:14

All Paths From Source to Target - 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 그래프의 edge 정보가 주어진다. 0번 노드 ~ N-1번 노드까지 가능한 모든 경로를 구해 반환하는 문제다. 1. DFS from typing import * class Solution: def allPathsSourceTarget(self, input_list: List[List[int]]) -> List[List[int]]: graph = {} len..

article thumbnail
239. Sliding Window Maximum
Algorithm 2021. 8. 14. 18:39

Sliding Window Maximum - 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 슬라이딩 윈도 사이즈 k가 주어진다. 슬라이딩 윈도를 수행하면서 윈도 내 가장 큰 정수를 list로 저장해서 반환하는 문제다. 예시는 다음과 같다. Input: nums = [1,3,-1,-3,5,3,6,7], and k = 3 Output: [3,3,5,5,6,7] Explanation: Window position Max --------------- ----- [1 3..

article thumbnail
297. Serialize and Deserialize Binary Tree
Algorithm 2021. 8. 12. 12:41

Serialize and Deserialize Binary Tree - 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 이진트리가 주어진다. 이진트리를 직렬화(serialize)해 문자열로 반환하고, 반환된 문자열을 역직렬화(deserialize)해서 이진트리를 복원하는 메서드를 작성하는 문제다. 직렬화 및 역직렬화 방법에 제한은 없다. 1. 초기 접근법 처음에 나는 이 문제를 전위(pre-order), 중위(in-order) 순회 정보를 가지고 트리를 복구하는 ..

실전! 스프링 데이터 JPA
Review 2021. 8. 11. 16:57

실전! 스프링 데이터 JPA - 인프런 | 강의 스프링 데이터 JPA는 기존의 한계를 넘어 마치 마법처럼, 리포지토리에 구현 클래스 없이 인터페이스 만으로 개발을 완료할 수 있습니다. 그리고 반복 개발해온 기본 CRUD 기능도 모두 제공합니다 www.inflearn.com 후기 Spring Data JPA 사용법 및 활용하는 내용을 다루는 강의. 추천하는 대상 당장 JPA를 실무나 프로젝트에 사용하셔야 되는 분 실습하시면서 원리나 개념을 추가로 공부하실 분 Spring(Boot)를 통한 웹 서버 개발 관련 기초 지식이 있으신 분 비추천하는 대상 Java 및 Spring(Boot)를 통한 웹 서버 개발 경험이 없으신 분 원리나 개념을 숙지 후 사용하시는 스타일이신 분