Algorithm
[BOJ-2579] Climbing Stairs Problem and Dynamic Programming (Golang)
Introduction In fact, the problem was that I hadn’t dealt with dynamic programming for too long, and even when I did, I just glossed over it, thinking, “Oh, this is a thing.” So I couldn’t even touch this problem. This time, I decided to seriously study dynamic programming and attempted to solve the problem. What is Dynamic Programming? Dynamic Programming (DP) is an algorithm design technique that breaks a problem down into smaller subproblems and solves them. This technique is primarily used for optimization problems and operates by storing previous calculation results using memoization or tables, allowing for efficient solution of overlapping subproblems.
May 26, 2025
[Programmers] Joystick (Golang)
Problem Programmers - Joystick Complete the alphabet name using the joystick. Initially, it consists only of A. For example, if the name to be completed has three letters, it is AAA. If it has four letters, it is AAAA. Moving the joystick in each direction works as follows: ▲ - Next alphabet ▼ - Previous alphabet (Moving down from A goes to Z) ◀ - Move cursor left (If moving left from the first position, the cursor goes to the last character) ▶ - Move cursor right (If moving right from the last position, the cursor goes to the first character) For example, "JAZ" can be created in the following way: - Move the joystick up 9 times from the first position to complete J. - Move the joystick left 1 time to position the cursor at the last character. - Move the joystick down 1 time from the last position to complete Z. Therefore, it is possible to create "JAZ" with 11 moves, and this is the minimum movement. Create a solution function that returns the minimum number of joystick operations for the name provided as a parameter. This problem is classified as LEVEL 2 in the coding test practice section, but honestly, it felt more challenging for me than expected.
May 26, 2025
[Programmers] Immigration Check (Golang)
Problem Programmers Problem - Immigration Check n people are waiting in line for immigration check. Each immigration officer takes a different amount of time to process each person. At the start, all immigration desks are empty. Only one person can be processed at a desk at a time. The person at the front of the line can go to an empty desk to be processed. However, if there is a desk that finishes processing sooner, they can wait and go there instead. We want to minimize the total time it takes for everyone to be processed. You are given the number of people waiting for immigration n and an array times, where each element represents the time taken by an immigration officer to process one person. Write a solution function that returns the minimum time required to process all the people. Constraints - The number of people waiting for immigration is at least 1 and at most 1,000,000,000. - The time taken by each officer to process one person is at least 1 minute and at most 1,000,000,000 minutes. - There is at least 1 and at most 100,000 officers. Approach Generally, when the range is so wide, binary search can be used to solve the problem.
May 23, 2025
[BOJ-3273] Let's Solve the Two Sum Problem in Two Ways (Hash, Two Pointers) With Go
Problem Link to BOJ-3273 n positive integers a1, a2, ..., an are given, and they are distinct. The value of ai is a natural number, satisfying 1 ≤ ai ≤ 1000000. Given a natural number x, write a program to find the number of pairs (ai, aj) such that ai + aj = x (1 ≤ i < j ≤ n). The problem asks whether there exists a pair in the array that sums to the specified number x.
May 21, 2025
[BOJ-9934] Complete Binary Tree (Golang)
Overview While preparing for a job change, I had the opportunity to study tree algorithms again after a long time, which led me to write this post. The Complete Binary Tree Problem is a question where you need to determine and output the structure of a complete binary tree using an array obtained from an in-order traversal. To understand this problem, it is first necessary to grasp the concept of in-order traversal.
May 21, 2025