Lower bound: Examples & Code
Lower bound: Find the first position whose value is at least the target. Input is sorted first. Explore a worked example, complexity and tested code.
Explore algorithm visualizations code snippets and tutorials
Lower bound: Find the first position whose value is at least the target. Input is sorted first. Explore a worked example, complexity and tested code.
Catalan numbers: Use the recurrence C(n) = Σ C(i)C(n−1−i), with C(0)=1. Explore a worked example, complexity and tested code.
Divisor enumeration: Test every candidate divisor in ascending order. Explore a worked example, complexity and tested code.
Euler totient: Remove each distinct prime factor from the count using φ(n) = n ∏(1−1/p). Explore a worked example, complexity and tested code.
Binary GCD (Stein): Remove common powers of two, then repeatedly subtract odd values. Explore a worked example, complexity and tested code.