Skip to content
Skilled.dev

Learn and practice

Patterns

Learn to recognize a reusable approach, state its invariant, and understand when it applies. Each guide includes worked code and counterexamples.

Patterns

Sliding window: fixed and variable windows

Derive a window invariant, update state in constant time, and recognize when negative values or a different condition break the approach.

Patterns

Two pointers: sorted pairs, partitions, and in-place work

Understand why moving a pointer is safe. Work through sorted Two Sum, palindrome checks, and duplicate removal.

Patterns

Dynamic programming: states, transitions, and evaluation order

Build a recurrence from choices, define a complete state, and compare memoization with tabulation through a worked non-adjacent-sum problem.

Patterns

Prefix sums: range queries and signed subarray counts

Build prefix arrays and frequency maps, count target-sum subarrays with negative values, and test boundary and numeric assumptions.

Patterns

Binary search: lower bounds, upper bounds, and first true

Use a half-open boundary invariant to handle duplicates, missing answers, monotone predicates, and binary-search edge cases.

Patterns

Backtracking: subsets, permutations, and pruning

Model a decision tree, restore shared state, copy independent results, and justify pruning with worked subset and permutation code.

Patterns

Monotonic stacks: next greater values and stock spans

Trace unresolved indexes, choose strict or non-strict comparisons, and prove linear total work with tested next-greater and span implementations.

Patterns

Heaps and priority queues: keep the K largest stream values

Implement a numeric min-heap, choose the right top-K orientation, and separate heap order, sorted output, and update costs.

Patterns

Tries for prefix search: insert, count, and delete words

Build an iterative Unicode-aware trie with prefix counts, duplicate handling, safe deletion, explicit text contracts, and operation-cost analysis.

Patterns

Union-find: weighted components, path halving, and connectivity

Implement disjoint sets with weighted unions, trace component counts, explain amortized costs, and distinguish connectivity from paths and deletions.

Patterns

Greedy algorithms: interval scheduling, exchange proofs, and counterexamples

Prove earliest-finish interval scheduling, implement a nonmutating selector, reject tempting rules with counterexamples, and test against exhaustive subsets.