What I used to calculate before writing code
Revisiting old C-style Baekjoon solutions to find habits around input size, memory, iteration counts, and state lifetime.
I write about what I learn while building, how I work with AI, and how I make sense of systems.
Revisiting old C-style Baekjoon solutions to find habits around input size, memory, iteration counts, and state lifetime.
A dynamic programming solution with states for the number of consecutive glasses consumed.
Interval DP for finding the cheapest way to parenthesize a matrix product.
Scan each row in both directions and combine the best values from the preceding row.
A dependency DP that memoizes the latest completion time among prerequisite buildings.
A memoized DFS that counts paths by walking backward from the destination to higher neighbors.
A combinatorial DP recurrence based on adding a number or reducing the target sum.
A knapsack solution indexed by released memory to minimize app deactivation cost.
A one-dimensional 0/1 knapsack DP that iterates weights backward to avoid selecting an item twice.
Reduce a Fibonacci range sum to two terms and compute them with matrix exponentiation.
Fill empty cells with backtracking while tracking numbers used in each row, column, and 3×3 box.
Place one queen per row, mark attacked cells below it, and restore those marks when backtracking.
A Platinum DP solution that expands smaller diamonds and checks all four edges.
Computing a very large Fibonacci index with fast exponentiation of a 2×2 matrix.
Use fast matrix exponentiation to compute Fibonacci numbers with a different modulus.
Precompute primality before factoring a large batch of input numbers.
Enumerate archer placements and simulate each game independently.
Precomputing primality and reducing a sum of four primes to searches for pairs.
A segmented sieve that marks multiples of squares within the requested interval.
Generate primes with a sieve, then search consecutive ranges whose sum matches the target.
Try common ratios and check whether a normalized geometric sum divides the target.
My first algorithm exercise: checking every combination of three cards.
Could not load posts. Please try again.