Algorithmic Solutions: Interval Partitioning, Graph Matching, and Trie-Based Set Operations
Problem A: Large-Scale Simulation
A pure simulation problem centered on game theory mechanics. The implementation involves directly modeling the described rules and state transitions.
Problem B: Maximum Total Range for k-Partition
Define the weight of a subarray as its range (maximum element minus minimum element). For each k from 1 to n, compu ...
Posted on Thu, 16 Jul 2026 16:19:13 +0000 by killfall
SM Training Camp Notes (2024.11.15 ~ 2024.11.29)
DAY0 (2024.11.15)
Finally arriving at the camp.
T2 GYM104787M
First, we define a replica connected component as a connected component formed by traversing only nodes with index greater than n. It's not hard to observe that a replica connected component (green nodes) connects to several leaves with index less than n, and together with the origin ...
Posted on Fri, 10 Jul 2026 17:44:56 +0000 by raffael3d
Add and Search Word Data Structure
Trie (Prefix Tree) Fundamentals
Binary trees consist of nodes where each node holds a value and pointers to left and right children:
struct Node {
int value;
Node* left;
Node* right;
};
A binary tree node has at most two children. When a tree node can have multiple children, it becomes a multi-way tree. Since the number of children ...
Posted on Sun, 05 Jul 2026 16:36:08 +0000 by Joeddox
Comprehensive Guide to String Operations and Algorithms
Strings are fundamental data structures that store sequences of characters. In C++, strings are zero-indexed and their length can be obtained using len = s.size(). Strings can also be implemented as character arrays with len = strlen(s).
Basic String Operations
Insretion
C++ strings support various insertion methods:
string s = "abcd" ...
Posted on Sat, 27 Jun 2026 17:47:12 +0000 by healthnut
Implementing a Trie Data Structure for Prefix-Based String Operations
Core Structure
Root node: An empty node serving as the entry point; its children represent the first characters of stored strings.
Internal nodes: Represent intermediate characters in strings.
Leaf nodes: Mark the end of a valid word via a boolean flag, evenif they have children (e.g., "do" and "dog" can coexist).
Basic Im ...
Posted on Mon, 22 Jun 2026 16:21:33 +0000 by Ruiser
Efficient Solutions for Word Search II Problem
Given an m x n board of characters and a list of strings words, return all words on the board.
Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
1. Trie with DFS
Build a trie from the given wor ...
Posted on Thu, 07 May 2026 19:06:04 +0000 by Lassie