Home
MINJUN PARK
Cancel

BOJ. Hide and Seek (1697)

Approach Treat each integer from 0 through 100000 as a state. From a state x, one move reaches x - 1, x + 1, or 2 * x, whenever that result is within the allowed range. Each edge therefore has cos...

Programmers. Find number of animals with same name

[Link] https://programmers.co.kr/learn/courses/30/lessons/59041 SELECT NAME, COUNT(NAME) AS COUNT FROM ANIMAL_INS WHERE NAME IS NOT NULL GROUP BY NAME HAVING COUNT(*) >= 2 ORDER BY NAME ASC;

Programmers — Largest Number

[Link] https://programmers.co.kr/learn/courses/30/lessons/42746 Approach Convert each number to a decimal string, then sort the strings with the rule that a comes before b exactly when a + b >...

LeetCode. 38. Count and Say

[Link] https://leetcode.com/problems/count-and-say/ Approach Start with the first term, "1". To produce each next term, scan the current term from left to right, identify each maximal run of ...

BOJ. Tomato (7569)

Problem link Each tomato box is a three-dimensional grid. A ripe tomato ripens its unripe neighbors in the six axis-aligned directions, and all changes happen simultaneously one day at a time. The...

LeetCode. 37. Sudoku Solver

A valid Sudoku board has one solution. Fill the empty cells in place so that every row, column, and 3 × 3 box contains each digit from 1 to 9 exactly once. Problem link Approach For each row, ...

LeetCode. 36. Valid Sudoku

[Link] https://leetcode.com/problems/valid-sudoku/ The board is valid when no filled digit is repeated in any row, column, or 3×3 box. Empty cells (.) are ignored; the partially filled board d...

BOJ. Tell Median Value (1655)

BOJ 1655: Say the Middle Number Maintain the values seen so far in two priority queues. lower is a max-heap containing the lower half, and upper is a min-heap containing the upper half. Keep both ...

LeetCode. 33. Search in Rotated Sorted Array

[Link] https://leetcode.com/problems/search-in-rotated-sorted-array/ Approach The array was sorted in ascending order and then rotated, and all values are distinct. At every binary-search step,...

LeetCode. 34. Find First and Last Position of Element in Sorted Array

[Link] https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Because the array is sorted, two binary searches can find the boundaries. The first search finds t...