/ https://42jerrykim.github.io/ _index.md
Avatar

42JerryKim

42는 'The Hitchhiker's Guide to the Galaxy'라는 SF 소설에서 삶, 우주, 그리고 모든 것에 대한 궁극적인 질문에 대한 해답이다.

  1. Home
  2. Collections
  3. Search
  4. Categories
  5. Tags
  6. Archives
    1. Dark Mode

Categories

Algorithm Vocabulary English BOJ Graph Movie Math Design Pattern Geometry CSharp

Tags

Documentation Implementation 문서화 구현 Best-Practices Code-Quality Testing 테스트 코드품질 Optimization 최적화 Debugging Tutorial 디버깅 Performance Education Guide Refactoring Clean-Code 교육

Archives

2026 170
2025 421
2024 177
2023 24
2022 79
More
Featured image of post [Algorithm] C++ 백준 3006번: 터보소트
Algorithm BOJ Data Structure Fenwick Tree Prefix Sum

[Algorithm] C++ 백준 3006번: 터보소트

홀수 단계는 가장 작은 수를, 짝수 단계는 가장 큰 수를 인접 스왑으로 제자리로 보낸다. 각 단계의 스왑 횟수는 현재 위치 기준 남아있는 원소 수의 prefix/suffix 합이다. Fenwick Tree로 삭제와 합 쿼리를 O(log N)에 처리한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 32115번: 돌 놓기 게임
Algorithm BOJ Game-Theory Greedy Sorting

[Algorithm] C++ 백준 32115번: 돌 놓기 게임

원형 보드를 돌-돌 사이의 빈 구간으로 분해한다. 같은 색 끝 구간은 독점, 다른 색 끝 구간은 양쪽 절반을 가져가고 홀수 길이는 가운데 값만 남는다. 남은 가운데 값들을 내림차순 정렬해 번갈아 더해 O(N log N)으로 점수를 구한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 32190번: Ian Sequences
Algorithm BOJ Constructive Math

[Algorithm] C++ 백준 32190번: Ian Sequences

1..N이 각각 두 번 등장하는 길이 2N 수열을 구성한다. S_N=[N,N-1]+S_{N-2}+[N,N-1]로 감싸며 (N-1)^2≡1, N≡1(mod N-1)로 모듈 조건을 귀납적으로 증명한다. 홀짝 베이스(S1,S2)에서 시작해 덱으로 O(N)에 생성·출력한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 33543번: 둘이 한 팀
Algorithm BOJ Data Structure Sorting Binary Search Prefix Sum

[Algorithm] C++ 백준 33543번: 둘이 한 팀

A,B 전체에 동일 증가가 반복된다. d=A-B를 정렬하고 delta=addA-addB로 흡수해 Σmax(d+delta,0)을 upper_bound와 누적합으로 O((N+Q)logN)에 계산한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 3948번: 홍준이의 친위대
Algorithm BOJ Combinatorics DP

[Algorithm] C++ 백준 3948번: 홍준이의 친위대

양끝을 제외한 모든 위치가 지역 최솟값/최댓값이 되도록 하는 순열을 센다. 이는 up-down(교대) 순열과 동치이며 Entringer 수 DP로 N≤20에서 오일러 지그재그 수를 빠르게 구한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 5498번: Batch Scheduling
Algorithm BOJ DP Convex Hull Trick

[Algorithm] C++ 백준 5498번: Batch Scheduling

연속 작업을 배치로 나눌 때 총 비용(출력시간×가중치)을 최소화한다. DP 점화식을 정리해 일차함수 최소화 형태로 만들고, 단조 조건을 이용한 Convex Hull Trick으로 O(N)~O(N log N)에 해결한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 5813번: 이상적인 도시
Algorithm BOJ Graph Tree Grid Shortest Path

[Algorithm] C++ 백준 5813번: 이상적인 도시

격자 도시(구멍 없음)의 최단거리 합을 행/열 연속구간으로 압축해 두 가중 트리로 분해한다. 각 트리에서 간선 절단 시 양쪽 가중치 곱을 합산해 O(N log N)으로 1e9 모듈 답을 구한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 6223번: Cow Sorting
Algorithm BOJ Greedy Sorting

[Algorithm] C++ 백준 6223번: Cow Sorting

스왑 비용이 두 소의 값 합일 때, 순열 사이클 분해로 최소 비용을 계산한다. 사이클 내부 교환과 전체 최소값 보조 교환을 비교해 O(N log N)으로 해결한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 7727번: Byephone
Algorithm BOJ String DP Divide and Conquer

[Algorithm] C++ 백준 7727번: Byephone

두 문자열(각 ≤10000)의 LCS 길이와 수열을 3MB 메모리로 출력한다. Hirschberg 분할정복으로 DP 2행만 유지해 O(nm) 시간, O(min(n,m)) 공간에 LCS를 복원한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 8155번: Postering
Algorithm BOJ Data Structures Stack Greedy

[Algorithm] C++ 백준 8155번: Postering

건물의 폭 d는 결과에 영향이 없고 높이만 보면 된다. 단조 스택으로 스카이라인 높이 변화를 추적하며, 높이가 내려갈 때마다 완료된 포스터를 카운트해 O(N)에 최소 포스터 수를 구한다.

12월 19, 2025
4 minute read
1 17 18 19 20 21 22 23 24 25 92
© 2018 - 2026 42JerryKim
Built with Hugo
Theme Stack designed by Jimmy