목록DFS (42)
넘치게 채우기
https://school.programmers.co.kr/learn/courses/30/lessons/131130#qna 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 프로그래머스 - 혼자 놀기의 달인 문제 유형 : 재귀, dfs 문제 난이도 : Level 2 문제 혼자서도 잘 노는 범희는 어느 날 방구석에 있는 숫자 카드 더미를 보더니 혼자 할 수 있는 재미있는 게임을 생각해냈습니다. 숫자 카드 더미에는 카드가 총 100장 있으며, 각 카드에는 1부터 100까지 숫자가 하나씩 적혀있습니다. 2 이상 100 이하의 자연수를 하나 정해 그 수보다 작거나 ..
https://leetcode.com/problems/restore-the-array-from-adjacent-pairs/description/ Restore the Array From Adjacent Pairs - LeetCode Can you solve this real interview question? Restore the Array From Adjacent Pairs - There is an integer array nums that consists of n unique elements, but you have forgotten it. However, you do remember every pair of adjacent elements in nums. You are give leetcode.co..
https://leetcode.com/problems/validate-binary-tree-nodes/description/ Validate Binary Tree Nodes - LeetCode Can you solve this real interview question? Validate Binary Tree Nodes - You have n binary tree nodes numbered from 0 to n - 1 where node i has two children leftChild[i] and rightChild[i], return true if and only if all the given nodes form exactly one val leetcode.com 문제 유형 : BFS / DFS 문제..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/brb29u/btsytOfzvwQ/DduUFtQaosonsNlfaVIk81/img.png)
https://school.programmers.co.kr/learn/courses/30/lessons/1829 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 유형 : bfs / dfs 문제 난이도 : Level 2 문제 설명 출판사의 편집자인 어피치는 네오에게 컬러링북에 들어갈 원화를 그려달라고 부탁하여 여러 장의 그림을 받았다. 여러 장의 그림을 난이도 순으로 컬러링북에 넣고 싶었던 어피치는 영역이 많으면 색칠하기가 까다로워 어려워진다는 사실을 발견하고 그림의 난이도를 영역의 수로 정의하였다. (영역이란 상하좌우로 연결된 같은 색상의 공간을 의미..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bDiiwd/btsgD9AVuB7/VYk3EndijJfdvwwrW9Dyr0/img.png)
https://leetcode.com/problems/shortest-bridge/description/ Shortest Bridge - LeetCode Can you solve this real interview question? Shortest Bridge - You are given an n x n binary matrix grid where 1 represents land and 0 represents water. An island is a 4-directionally connected group of 1's not connected to any other 1's. There are exactly leetcode.com 문제 유형 : DFS / BFS 문제 난이도 : Medium 문제 You ar..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/b7HGo6/btsgECvUF7T/n5zNbpCmFv2wq2pXT5k4EK/img.png)
https://leetcode.com/problems/evaluate-division/ Evaluate Division - LeetCode Can you solve this real interview question? Evaluate Division - You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is leetcode.com 문제 유형 : DFS / BFS 문제 난이도 : Medium 문제 You are given..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/OiTEF/btsgEdW5fDD/3Px37dvyBc6XFOskjkmxLK/img.png)
https://leetcode.com/problems/is-graph-bipartite/description/ Is Graph Bipartite? - LeetCodeCan you solve this real interview question? Is Graph Bipartite? - There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. Moleetcode.com문제 유형 : DFS / BFS 문제 난이도 : Medium 문제 T..
백트래킹 기법은 해를 찾는 도중, 해가 될 가능성이 없으면 이전으로 되돌아가면서 시간을 아끼는 방법이다. 보통 구현 방식은 DFS의 중간에 조건식을 넣어서, 더 깊게 들어가봤자 의미가 없다는 것을 판단시킨 후, 이전으로 돌아가게 하는 식으로 한다. 이 과정을 가지치기라고 하고, 이 가지치기의 조건을 얼마나 잘 설정하느냐가 관건이 된다.
Brute Force. 무식한 힘이란 뜻인데, 풀어 말하면 무식하게 풀기라고 할 수 있다. 완전히 모든 경우를 탐색하여 조건에 맞는 결과를 가져오는 것이다. 속도가 어떻게 될지라도, 반드시 결과를 가져온다. 선형 구조에서는 주로 순차 탐색, 비선형 구조에서는 BFS와 DFS등을 주로 사용한다. 장점으로는 반드시 답을 찾는다는 점이고, 단점으로는 느리거나 메모리를 많이 사용할 수 있다는 점이다. 브루트 포스의 문제 해결 과정 1. 주어진 문제를 구조화 한다. 2. 구조화 된 문제의 모든 해를 구하도록 탐색한다. 3. 구성된 해를 정리한다.
https://www.acmicpc.net/problem/1068 1068번: 트리 첫째 줄에 트리의 노드의 개수 N이 주어진다. N은 50보다 작거나 같은 자연수이다. 둘째 줄에는 0번 노드부터 N-1번 노드까지, 각 노드의 부모가 주어진다. 만약 부모가 없다면 (루트) -1이 주어진다 www.acmicpc.net 문제 유형 : DFS / 트리 solved.ac 난이도 : Gold V 문제 트리에서 리프 노드란, 자식의 개수가 0인 노드를 말한다. 트리가 주어졌을 때, 노드 하나를 지울 것이다. 그 때, 남은 트리에서 리프 노드의 개수를 구하는 프로그램을 작성하시오. 노드를 지우면 그 노드와 노드의 모든 자손이 트리에서 제거된다. 입력 첫째 줄에 트리의 노드의 개수 N이 주어진다. N은 50보다 작거나..