Algorithms
The Algorithms section contains programming exercises focused on problem solving, data processing, algorithm design, validation, graph relationships, scheduling, optimization, string processing, and combinatorial reasoning.
The section contains:
9 groups
45 tasks
Each group contains five tasks.
The groups are organized to introduce different categories of problems rather than following a strictly linear difficulty scale.
As the section progresses, the exercises move between:
- collection processing
- sorting and grouping
- pair and frequency analysis
- combinations
- validation
- structured processing
- graphs
- scheduling
- state machines
- optimization
- manual string processing
- constraint-based combinations
The objective is not only to produce the expected result.
Solutions should also be:
- correct
- deterministic
- testable
- understandable
- properly validated
- reasonably efficient
General Approach
Before implementing a task:
- Identify the exact input.
- Identify the required output.
- Determine the validation rules.
- Identify important edge cases.
- Separate data preparation from processing.
- Choose an appropriate algorithm.
- Verify the result using the provided examples.
- Add additional tests.
For optimization tasks, also distinguish:
valid solution
from:
optimal solution
For stateful tasks, distinguish:
current state
from:
requested state change
For graph and dependency tasks, validate the structure before attempting to process it.
Group 1 — Basic Data Transformation and Search
The first group introduces fundamental collection-processing problems.
Tasks include:
String Pair Conversion
Multi-Dimensional Value Search
Conditional Map Filtering
Matrix Diagonal Processing
Map Sorting
Main topics:
- string conversion
- numeric conversion
- slices
- maps
- nested collections
- conditional filtering
- matrix traversal
- deterministic ordering
This group establishes the basic processing patterns used throughout the library.
Group 2 — Sorted Data and Range Grouping
The second group focuses on maintaining order and dividing values into numeric ranges.
Tasks include:
Maximum Value per Group
Sorted Element Insertion
Fixed Range Grouping
Sorted Range Insertion
Configurable Range Grouping
Main topics:
- maximum-value search
- sorted collections
- insertion
- range boundaries
- grouping
- configurable segmentation
The tasks require careful handling of ordering and boundary conditions.
Group 3 — Pair Analysis and Frequency Processing
The third group introduces relationships between corresponding values and statistical properties of collections.
Tasks include:
Pair Sum Matching
Pair Sum Delta Matching
Frequency Grouping
Indexed Multiplication Limits
Pair Normalization Analysis
Main topics:
- indexed relationships
- pair calculations
- tolerance ranges
- frequency counting
- threshold comparison
- inward pairing
- normalization
This group develops reasoning about relationships between values rather than isolated elements.
Group 4 — Collection Relationships and Combinations
The fourth group focuses on relationships between complete collections.
Tasks include:
Collection Equality
Three-Element Average Combinations
Common Values
Closest Values to Target
Common Adjacent Pairs
Main topics:
- multiset equality
- combinations
- intersections
- proximity
- adjacency
- cross-list analysis
Several tasks require comparing multiple collections while preserving clearly defined ordering or uniqueness rules.
Group 5 — Validation and Structured Processing
The fifth group introduces larger structured-processing problems.
Tasks include:
Configurable String Validation
User Login and Access Control
Sector Range Analysis
Generic Pipeline Stability Analysis
Multi-Sector Pipeline Stability Report
Main topics:
- configurable validation
- multiple validation errors
- authentication
- authorization
- account state
- sector segmentation
- generic numeric processing
- stability thresholds
- structured reports
The tasks begin to combine several processing rules into one operation.
Instead of performing one transformation, implementations must coordinate validation, domain rules, and structured output.
Group 6 — Graphs, Scheduling, and State
The sixth group focuses on relationships that form graphs, dependency networks, schedules, and state transitions.
Tasks include:
Dependency Graph Resolution
Weighted Route Resolution
Dependency-Aware Task Scheduler
State Machine Validation
Event Stream Window Analysis
Main topics:
- directed graphs
- dependencies
- cycle detection
- topological ordering
- weighted paths
- scheduling
- limited workers
- state machines
- transition validation
- event windows
- burst detection
This group introduces problems where relationships between entities determine which operations are possible.
Deterministic behavior is particularly important when several valid processing orders exist.
Group 7 — Optimization and Planning
The seventh group focuses on problems where producing any valid solution is not enough.
The implementation must find the best solution according to a defined objective.
Tasks include:
Weighted Interval Scheduling
Multi-Resource Capacity Selection
Minimum Cost Assignment
Capacity-Constrained Route Planning
Deadline and Penalty Scheduling
Main topics:
- interval optimization
- dynamic programming
- multidimensional capacity
- subset selection
- assignment
- route planning
- scheduling
- deadlines
- penalties
- solution reconstruction
These tasks introduce the distinction between:
feasibility
and:
optimality
A result may satisfy every constraint and still be incorrect if a better valid solution exists.
Depending on the task and input size, useful techniques may include:
dynamic programming
backtracking
memoization
branch and bound
graph algorithms
exhaustive search
Group 8 — Manual String Processing
The eighth group focuses on implementing string-processing behavior without relying on standard-library functions that directly solve the required operation.
Tasks include:
Manual Substring Search
Multiple Substring Search
Match Range Collection
Manual String Replacement
Multi-Source Search Analysis
Main topics:
- manual substring search
- multiple search patterns
- range collection
- replacement
- token processing
- occurrence counting
- multi-source analysis
The purpose of the restrictions in this group is to expose the underlying processing logic.
Functions that directly perform the required operation should not be used.
For example, depending on the task, avoid helpers that directly provide:
substring search
contains
count
replace
split
regular-expression matching
Normal language features such as:
loops
indexing
length
collection creation
manual output construction
remain allowed.
Group 9 — Advanced Combinations and Constraint Processing
The final group combines reconstruction, compatibility, Cartesian products, and conditional combination generation.
Tasks include:
Unique and Common Values
Sector Range Reconstruction
System Version Compatibility
Generic Combination Generator
Conditional Combination Generator
Main topics:
- global frequency analysis
- missing-value reconstruction
- sector correction
- compatibility relationships
- Cartesian products
- configurable combination generation
- target sums
- delta ranges
- constraint filtering
This group closes the Algorithms section with problems that combine several earlier ideas.
The tasks require reasoning about complete sets of possibilities while respecting additional constraints.
Progression
The section can be viewed conceptually as:
Group 1
Basic Data Transformation and Search
↓
Group 2
Sorted Data and Range Grouping
↓
Group 3
Pair Analysis and Frequency Processing
↓
Group 4
Collection Relationships and Combinations
↓
Group 5
Validation and Structured Processing
↓
Group 6
Graphs, Scheduling, and State
↓
Group 7
Optimization and Planning
↓
Group 8
Manual String Processing
↓
Group 9
Advanced Combinations and Constraint Processing
The progression is intentionally not a strict difficulty ladder.
Different groups emphasize different types of reasoning.
A string-processing problem may be more difficult than a graph problem for one implementation, while an optimization problem may require a completely different approach from both.
The goal is broad algorithmic practice.
Input Validation
Unless a task explicitly states otherwise, implementations should validate input that would make the requested operation undefined or structurally invalid.
Examples include:
duplicate IDs
invalid indexes
invalid ranges
negative capacities
invalid intervals
missing dependencies
cyclic dependencies
mismatched collection lengths
unsupported operators
invalid configuration
unknown references
Validation should happen before performing destructive or state-changing processing where applicable.
Deterministic Results
Some problems allow several mathematically valid answers.
When the task defines a tie-breaking rule, that rule must be followed.
When deterministic behavior is required but no natural ordering exists, a documented rule should be used.
Examples include:
ascending numeric order
lexicographical ID order
lowest worker ID
earliest start time
lowest total resource usage
Running the same task with the same input should produce the same result.
Result Models
Prefer structured results when an operation produces several related values.
For example:
type Result struct {
Valid bool
Values []int
Errors []string
}
is usually easier to understand and test than several unrelated return values.
Optimization tasks should normally return both:
optimal objective value
selected solution
For example:
TotalValue
SelectedJobs
or:
TotalCost
Assignments
Returning only the numeric optimum is not enough when the task requires reconstruction of the actual solution.
Testing
Every task should include tests for:
provided examples
normal valid input
boundary conditions
empty input where applicable
invalid input
deterministic behavior
Depending on the task, also test:
duplicates
equal values
missing values
zero values
negative values
overlapping intervals
cycles
unreachable nodes
multiple optimal solutions
capacity exhaustion
invalid state transitions
Optimization tasks should contain cases where an obvious greedy solution is not optimal.
This helps verify that the implementation actually solves the optimization problem rather than only producing a plausible result.
Performance
The exercises are designed primarily for correctness and reasoning.
However, implementations should still consider algorithmic complexity.
Examples include:
repeated full scans
nested loops
unnecessary allocations
repeated sorting
exponential combination growth
graph traversal complexity
dynamic-programming state size
Some tasks intentionally use small datasets because exact combinatorial optimization can grow rapidly.
Do not replace a correct exact solution with an undocumented heuristic when the task requires the optimal result.
Language Independence
The tasks are language-independent.
They may be implemented in:
Go
Rust
C++
or another suitable programming language.
The examples may use Go-style models because they provide a concise representation of the required structures.
The important part is the behavior of the solution, not the specific language syntax.
Goal
The Algorithms section is designed to develop several forms of problem-solving ability:
data transformation
search
sorting
grouping
pair analysis
collection comparison
combinatorial reasoning
validation
graph processing
dependency resolution
scheduling
state processing
optimization
manual string algorithms
constraint processing
A successful solution should not only return the expected output.
It should also make it clear:
why the result is correct
which rules were applied
which edge cases were considered
which constraints were satisfied
and, where required, why the result is optimal