문제 출처: https://www.acmicpc.net/problem/2606 풀이법: 인접행렬을 이용한 dfs 알고리즘으로 풀었다. Comment: 1) class 이름을 Main으로 하지 않으면 컴파일 에러가 난다. 2) 인접행렬은 사이즈에 + 1 만큼 행, 열을 생성하는게 편리하다. (방문 노드 체크 행렬도 마찬가지) -> 이유? : 행렬의 인덱스는 0으로 시작하는 반면에 코테 문제에서 나오는 그래프에선 0번 노드가 잘 등장하지 않기 때문. 코드: import java.util.*; public class Main { public static int count = 0; public static void main(String[] args) { // TODO Auto-generated method st..
class Solution { public boolean solution(String[] phone_book) { for(int i = 0; i < phone_book.length; i++){ for(int j = 0; j < phone_book.length; j++){ if(i != j && phone_book[j].startsWith(phone_book[i])){ return false; } } } return true; } } 해시를 사용하면서 얻는 이점을 전혀 모르겠다.
import java.util.*; class Solution { public String solution(String[] participant, String[] completion) { String fail = ""; HashMap answer = new HashMap(); int value = 0; for(int i = 0; i< participant.length; i++){ if(answer.containsKey(participant[i])){ value = answer.get(participant[i]); answer.put(participant[i], value + 1); }else{ answer.put(participant[i], 1 ); } } for(int i = 0; i < complet..
- Total
- Today
- Yesterday
- Java
- 신규 아이디 추천
- 프로그래밍 모델
- PatternSyntaxException
- KAKAO 2021
- Java #JIT #JVM
- 코테
- 카카오
- WORE
- 스프링
- 카카오코테
- 스프링 컨테이너
- okhttp3
- decorator
- Java #GC #가비지콜렉터 #Garbage Collector
- 카카오 코테
- 카카오 인턴
- digital tree
- IOC
- 모던 자바 인 액션
- WORA
- 2019 Kakao Blind
- Kakao Blind
- trie 소스코드
- 디자인패턴
- jvm
- 2020 KAKAO
- nginx 내부
- 2021
- behavior parameterization
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |