Greedy Algorithm Applications: Digit Removal and Three-Value Sorting

Minimizing a Number by Removing Digits The goal is to take a high-precision positive integer n (up to 240 digits) and remove s digits such that the remaining digits, in their original order, form the smallest possible integer. Problem Strategy A common mistake is to sort the digits and remove largest ones. However, this violates the rule of ma ...

Posted on Thu, 14 May 2026 14:08:55 +0000 by kucing

Maximum Credits from Homework Assignments Using Greedy Algorithm with Priority Queue

Problem Statement A teacher assigns all homework on the first day of school. Each homework assignment earns credits only if submitted before its deadline. Each assignment has a different deadline and credit value, and each assignment requires exactly one day to complete. For example, if a assignment has 10 credits with a deadline of 6 days, you ...

Posted on Sat, 09 May 2026 14:29:11 +0000 by plehmurof

Algorithmic Solutions for Codeforces Round 882 Division 2

Problem A: The Man who became a God To solve this problem, consider the absolute differences between adjacent elements in the sequence. Let the sequence be (a_1, a_2, \dots, a_n). The total cost is initially the sum of (|a_i - a_{i+1}|) for all (1 \le i < n). The operation allows removing (k-1) of these differences to minimize the remaining ...

Posted on Thu, 07 May 2026 21:33:07 +0000 by Fearsoldier

Competitive Programming: Greedy Algorithms and Binary Search Strategies

Dynamic Bound Tracking for Absolute Value SumsWhen calculating the maximum possible sum of an array where an absolute value operation can be applied to the running total at any point, tracking the exact moment to apply the operation is complex. A flawed approach might conditionally apply absolute values based on the sign of the next element and ...

Posted on Thu, 07 May 2026 09:53:27 +0000 by cpace1983