Skip to content

KKPASII/7-Day-Coding-Test-Rehab-with-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

🧠 7-Day Java Coding Test Rehab

코딩테스트 감각 재활을 위한 7일 집중 문제 풀이 루틴 (with LeetCode)

가장 많이 나오는 패턴 포함 (총 35문제)

  • Hash / Two pointer / Sliding window / Stack / Linked list / Tree / Graph / Heap

🚀 Study Stack

Category Stack
Language Java
Platform LeetCode
Reference Tech Interview Handbook

📅 7-Day Problem List

Day 1 — Java 재활 / 기본 자료구조

Done Problem Link
Two Sum LeetCode
Contains Duplicate LeetCode
Valid Anagram LeetCode
Valid Parentheses LeetCode
Maximum Subarray LeetCode
Reverse Linked List LeetCode

Day 2 — Array / Two Pointer

Done Problem Link
Longest Substring Without Repeating Characters LeetCode
Container With Most Water LeetCode
3Sum LeetCode
Product of Array Except Self LeetCode
Longest Consecutive Sequence LeetCode

Day 3 — Stack / Interval

Done Problem Link
Min Stack LeetCode
Daily Temperatures LeetCode
Merge Intervals LeetCode
Insert Interval LeetCode
Meeting Rooms LeetCode

Day 4 — Linked List

Done Problem Link
Reverse Linked List LeetCode
Merge Two Sorted Lists LeetCode
Linked List Cycle LeetCode
Remove Nth Node From End of List LeetCode
Reorder List LeetCode

Day 5 — Tree

Done Problem Link
Invert Binary Tree LeetCode
Maximum Depth of Binary Tree LeetCode
Validate Binary Search Tree LeetCode
Binary Tree Level Order Traversal LeetCode
Lowest Common Ancestor of a Binary Tree LeetCode

Day 6 — Graph / BFS / DFS

Done Problem Link
Number of Islands LeetCode
Clone Graph LeetCode
Course Schedule LeetCode
Pacific Atlantic Water Flow LeetCode
Rotting Oranges LeetCode

Day 7 — Heap / Advanced

Done Problem Link
Top K Frequent Elements LeetCode
Kth Largest Element in an Array LeetCode
Merge k Sorted Lists LeetCode
Find Median from Data Stream LeetCode

🧩 Problem Solving Strategy

1️⃣ Pattern Classification

문제를 읽고 바로 구현하지 않고 먼저 어떤 알고리즘 패턴인지 분류하기

Problem Pattern Typical Approach
중복 검사 / 빈도 계산 HashMap / HashSet
두 값 조합 / 정렬 후 탐색 Two Pointer
부분 문자열 / 구간 최적화 Sliding Window
괄호 / 순서 / 이전 상태 비교 Stack
그래프 / 연결 구조 탐색 BFS / DFS
정렬된 데이터 탐색 Binary Search
상위 K개 문제 Heap / PriorityQueue
선후 관계 문제 Topological Sort
트리 문제 Tree DFS / BFS

2️⃣ Brute Force First

처음부터 최적해를 찾기보다는 가장 단순한 해결 방법을 먼저 생각하기

예: O(n²) brute force

  • 이미 계산한 정보를 저장할 수 있을까?
    • HashMap
  • 정렬하면 문제를 단순화할 수 있을까?
    • Two Pointer
  • 포인터 이동으로 줄일 수 있을까?
    • Sliding Window

3️⃣ Manual Simulation

코드를 작성하기 전에 예제를 직접 시뮬레이션하기

  • 문자열 문제
  1. left pointer
  2. right pointer
  3. current substring
  4. map 상태
  • 그래프 문제
  1. queue 상태
  2. visited 상태

4️⃣ Apply Algorithm Template

패턴이 정해지면 검증된 템플릿 구조를 사용하기

Sliding Window

int left = 0;

for (int right = 0; right < n; right++) {

    // window expand

    while (condition violated) {
        left++;
    }

    // update answer
}

BFS

Queue<int[]> q = new LinkedList<>();
q.offer(start);
visited[start] = true;

while (!q.isEmpty()) {
    int cur = q.poll();
}

Two Pointer

int left = 0;
int right = arr.length - 1;

while (left < right) {

    int sum = arr[left] + arr[right];

    if (sum == target) break;

    if (sum < target)
        left++;
    else
        right--;
}

5️⃣ Edge Case Check

  • empty array
  • single element
  • duplicate values
  • negative numbers
  • off-by-one (< vs <=)
  • overflow 가능성

About

"코딩테스트 감각 재활을 위한 7일 집중 문제 풀이 루틴"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors