Contest Round 33 Editorial: Emphasis on Algorithmic Thinking

A. Word Rearrangement This is a straightforward problem requiring only basic input/output handling. w1, w2 = input().split() print(w2) print(w1) B. Cooking Tangyuan The key idea is to simulate the process of using packages to fulfill cooking rounds. Each package contributes a fixed number of tangyuan, and excess can carry over. n, x, k = map(i ...

Posted on Sun, 17 May 2026 14:48:21 +0000 by Fjerpje

Interval Dynamic Programming: Classic Problems and Solutions

Progress: Dynamic Programming - Linear DP, Knapsack, Interval DP Merging Palindromic Substrings Tags: Interval DP Foundation - Longest Palindromic Substring Problem: Given a string (S), find the length of its longest palindromic substring. Approach: A longer palindrome can always be constructed by adding identical characters to both ends of a s ...

Posted on Thu, 14 May 2026 05:56:34 +0000 by sb

Greedy Algorithm: Minimum Cameras to Monitor a Binary Tree

Greedy Algorithm: Minimum Cameras to Monitor a Binary Tree Given a binary tree, we need to place cameras on nodes such that every node in the tree is monitored. A camera placed on a node monitors itself, its parenet, and its immediate children. Determine the minimum number of cameras required. Approach We can solve this problem using a greedy a ...

Posted on Wed, 13 May 2026 14:26:44 +0000 by TPerez

LLVM RAGreedy Register Allocator Internals: Allocation, Eviction, Splitting, and Spilling Mechanics

Core Core Data Structures Structure Purpose LiveIntervals Stores live ranges for every virtual register LiveRegMatrix Tracks physical-to-virtual mappings and interference PriorityQueue Heap-based queue ordered by Priority VirtRegMap Final virtual → physical assignment EvictAdvisor Decides whether evicting an existing allocation i ...

Posted on Wed, 13 May 2026 03:59:11 +0000 by dnice

Codeforces Round 966 (Div. 3) Solutions

A. Primary Task Approach The string is invalid in the following cases: Length ≤ 2. Does not start with "10". The substring after "10" converts to an integer less than 2, or has leading zeros. #include <bits/stdc++.h> using namespace std; using i64 = long long; void solve() { string s; cin >> s; if ...

Posted on Tue, 12 May 2026 16:38:35 +0000 by Janjan

Preliminary solutions for AtCoder Beginner Contest 064

Problem A: Check multiples of 4 Given three digits a, b, c (most significant first), form the three-digit number n = 100*a + 10*b + c. Determine whether n is divisible by 4. int a, b, c; cin >> a >> b >> c; int n = a * 100 + b * 10 + c; cout << (n % 4 == 0 ? "YES" : "NO") << "\n"; Pro ...

Posted on Mon, 11 May 2026 07:02:20 +0000 by lostsoul111455

LeetCode Daily Challenge: Convert to 2D Array

Given an integer array nums, construct a 2D array that satisfies the following conditions: The 2D array should contain only elements from the array nums. Each row of the 2D array must consist of distinct itnegers. The number of rows should be minimized. Return any valid result. If multiple solutions exist, any one is acceptable. Note: Rows in ...

Posted on Sun, 10 May 2026 15:14:55 +0000 by songwind

Minimum Days to Create m Bouquets Using Binary Search

Problem Overview Given an array bloomDay where bloomDay[i] represents the day on which the i-th flower blooms, determine the minimum number of days required to make m bouquets. Each bouquet requires exactly k adjacent flowers that have already bloomed. If it's impossible to create m bouquets (insufficient flowers), return -1. Constraints 1 &lt ...

Posted on Sat, 09 May 2026 21:41:34 +0000 by dujed