Hi👋SpeedAlgo • Deliberate Practice & Cognitive Ergonomics for Software Engineers

An interactive algorithm mastery and technical interview preparation platform published by Hi👋WebEnterprise. Built for senior and staff software engineers preparing for rigorous coding screens at top tech companies (FAANG/MAMAA).

13 Core Algorithmic Patterns & 225 Practice Problems

  • 1. Two Pointers (16 Paradigms, 43 Problems): Opposite ends, sorted pair sums, palindrome verification, trapping rain water, 3Sum, container with most water — includes the Sliding Window and Fast & Slow Pointers paradigms (contiguous subarray invariants, longest substrings, Floyd's cycle detection, linked list middle).
  • 2. Binary Search (9 Paradigms, 14 Problems): Monotonic predicate partitioning (feasible(x)), boundary search, rotated sorted arrays, square roots, minimum ship capacity, median of two sorted arrays, matrix median on value range.
  • 3. Bit Manipulation (5 Paradigms, 11 Problems): Counting set bits, XOR cancellation, bit reversal, bitmask pairing, maximum XOR with a bitwise trie.
  • 4. Math & Geometry (8 Paradigms, 14 Problems): Sieve of Eratosthenes, integer/roman conversions, modular arithmetic, geometric simulation.
  • 5. Tree/Graph Depth-First Search (15 Paradigms, 24 Problems): Path sums, lowest common ancestor, tree diameter, validating BSTs, tree DP (House Robber III, Binary Tree Cameras).
  • 6. Tree/Graph Breadth-First Search (5 Paradigms, 12 Problems): Level-order traversals, shortest path in unweighted graphs, zig-zag traversals, rotting oranges, word ladders.
  • 7. Graphs (12 Paradigms, 22 Problems): Topological sort, cycle detection, Dijkstra's algorithm, bipartite graph validation, network delay.
  • 8. Backtracking (6 Paradigms, 14 Problems): Subsets, permutations, combinations, constraint satisfaction, pruning, N-Queens, Sudoku solver.
  • 9. Dynamic Programming (13 Paradigms, 28 Problems): Memoization vs tabulation, 0/1 knapsack, unbounded knapsack, coin change, edit distance, longest common subsequence.
  • 10. Heap / Priority Queue (9 Paradigms, 11 Problems): Running medians, top-k elements, interval scheduling, IPO, k-way merges.
  • 11. Advanced Data Structures (7 Paradigms, 17 Problems): Trie (prefix tree), Union-Find (Disjoint Set Union), LRU Cache, LFU Cache, range-sum queries with updates.
  • 12. Stack (5 Paradigms, 9 Problems): Next greater element, largest rectangle in histogram, remove k digits, decode string, min stack.
  • 13. Intervals & Greedy (2 Paradigms, 6 Problems): Merge intervals, interval scheduling, meeting rooms by sweep line, jump game.

4-Stage Deliberate Practice Framework

  1. Stage 1 (Compare & Learn): Read the pattern's mental model, loop invariant and Big-O proof, compare the pattern's template with the problem's solution side by side, and use the step-by-step debugger. The solution can also be shown in C#, Java, TypeScript, C++, Go or Rust for almost every problem.
  2. Stage 2 (Active Recall): Rebuild the solution from memory in a code editor, with an invariant checklist and optional progressive hints, and check it against a judged test suite.
  3. Stage 3 (AI Interview Coach, coming soon): A mock-interview stage still in development; for now, students go straight from Stage 2 to Stage 4.
  4. Stage 4 (Solve on Your Own): Solve a new problem on your own against a 15-minute timer; your code is graded against a test suite. Python and TypeScript run in your browser and C# runs on our server (design problems grade in Python and TypeScript).

Equipped with a spaced-repetition review hub on a fixed 7-step schedule (1 day up to 90 days), a two-pane Studio workspace, and study notes.

Pricing, Access & Commercial Terms

  • Core Curriculum: 100% Free. No credit card required.
  • Coins: New accounts get 40 free coins once, the daily claim adds +20 coins once a day, and inviting a friend earns you +25 coins when they complete their first practice step. These are the only ways to earn coins.
  • AI Coach: Each AI coach question costs 1-5 coins, priced by the server according to its size.
  • BYOK (Bring Your Own Key): AI coaching is free with your own Google Gemini, OpenAI or OpenRouter API key (BYOK).
  • Extras: Coins also unlock extras for 24 hours: a Recall hint level (1 coin), a Solve solution reveal (2), a LeetCode problem card's solutions (1) and a pattern's extra canonical problems (1).
  • Payments & Refunds: Nothing on the site is sold for money: coins can only be earned, never bought. There are no subscriptions or charges, so there is nothing to refund.
  • Platform Operator: Hi👋WebEnterprise. Support & policies at hispeedalgo.com.
Skip to main content
Hi👋SpeedAlgo

Invariant-First Algorithmic Mastery

Arena
238Items
Theory Context•Two Pointers & Sliding Window
MediumLC 128

Longest Consecutive Sequence (LeetCode 128)

Target Frequency:AmazonGoogleMetaMicrosoft

You get an integer array nums, in no particular order. A run is a chain of whole numbers that each exceed the one before by exactly 1 (x, x + 1, x + 2, ...). Find the longest run whose values all appear somewhere in nums, at any positions, and return how many values it holds.

Your algorithm has to finish in O(n) time.

Worked Examples

Example 1
Input:nums = [100,4,200,1,3,2]
Output:4
1000412002133425
Explanation: 1, 2, 3 and 4 all appear, so the run [1, 2, 3, 4] holds 4 values.
Example 2
Input:nums = [0,3,7,2,5,8,4,6,0,1]
Output:9
Explanation: Every value from 0 to 8 appears (0 twice), a run of 9 values.
Example 3
Input:nums = [1,0,1,2]
Output:3
Explanation: 0, 1 and 2 appear; the second 1 does not make the run longer.

⚖️Formal Constraints & Bounds

  • 0 <= nums.length <= 105

  • -109 <= nums[i] <= 109

Deep-Dive & Conceptual Insights

Core Insight

A run has exactly one value whose predecessor is missing from the set, so testing x - 1 in seen finds every run's start in O(1)O(1)O(1), and only a start is ever walked upward -- which is what keeps the whole scan linear.

Real-World Scenario & Production Applications

Compacting a set of IDs into ranges works the same way: free port numbers, allocated row IDs, or reserved seat numbers, collected in any order, fold into [start, end] blocks by the same test -- a value only opens a new block when the value one below it is not in the set.

Step-by-Step Execution Trace Table

Input nums = [100,4,200,1,3,2] (LeetCode Example 1, delta = 1). seen = {100,4,200,1,3,2}:

Stepleftleft - delta in seen?Actionlength reachedbest after the step
1100No (99 absent)Run start: walk 101 -- absent, stop11
24Yes (3 present)Not a start: skip--1
3200No (199 absent)Run start: walk 201 -- absent, stop11
41No (0 absent)Run start: walk 2✓, 3✓, 4✓, 5 absent, stop44
53Yes (2 present)Not a start: skip--4
62Yes (1 present)Not a start: skip--4
Endreturn 4: the run [1, 2, 3, 4]
Code Shape
Archetype Code Shape
Python
1A run of consecutive values has exactly one start: the value whose predecessor (`x - 1`) does not appear anywhere in the array.
2Put every value into a hash set once; for each value, check whether it is a run's start before doing any more work for it.
3`seen = set(nums)`; `for x in seen: if x - 1 in seen: continue` (skip anything that is not a start); otherwise `length = 1; while x + length in seen: length += 1`; track `best = max(best, length)`.
4The trap: skipping the `x - 1 in seen` check and walking from every value makes the scan $O(N^2)$ on one long run -- the pruning check is what keeps every value visited by at most one walk.

Conceptual Narrative

🧭 Conceptual Foundation & Pattern Intuition

A hash set answers one question in one step: "is this value here?" Finding the longest run of consecutive numbers in an unsorted array looks like it needs sorting first, but sorting spends O(Nlog⁡N)O(N \log N)O(NlogN) just to learn an ordering the problem never asks you to keep -- it only asks for the length of the longest run. A hash set gives the same "what comes next?" answer in O(1)O(1)O(1), so the real problem is not finding runs, it is finding run starts: a value is a start exactly when nothing one smaller than it exists, and once you are standing at a start, walking forward one step at a time with set lookups costs nothing extra because each value is only ever walked past once.

🏟️ The Analogy: Train Cars on a Siding, Found Out of Order

Picture rail cars numbered 1 through 9, uncoupled and shunted onto a siding in random order: car 4, then 100, then 1, then 3, then 2. A yard worker checking every car against every other car to find the longest coupled chain would take forever. Instead, she keeps a clipboard of every car number present (the hash set), and for each car asks one question: "is the car numbered one less than this one on my list?" If yes, this car is the middle or end of some chain and someone else will walk it from its front; skip it. If no, this car is a chain's front, so walk forward from it, car by car, counting how many are coupled before the chain breaks. Every car is asked "am I a front?" once, and every car is counted by a walk at most once, no matter how the cars were shunted onto the siding.

🔑 Why It Works

A run of consecutive values has exactly one smallest member, and that member is the only one in the run whose predecessor is missing from seen. So if x - 1 in seen: continue identifies, in O(1)O(1)O(1), every value that is not a run's start, and the while loop only ever fires for the one value per run that is. Across the whole array, the for loop costs NNN lookups and the combined while loops cost at most NNN more lookups, since each value is walked past by at most one run -- the one it belongs to.

  • Skipping the pruning check: walking the upward probe from every value, not only from values whose predecessor is absent, re-walks every run once per value inside it -- O(N^2) on one long run, which the problem's O(n) requirement forbids.

  • Not collapsing duplicates: iterating nums directly instead of set(nums) lets a repeated value either inflate length or waste work re-starting a walk already counted; set(nums) fixes both.

  • Forgetting the empty-array case: nums = [] must return 0; the explicit if not nums: return 0 guard makes this read as a deliberate check rather than an accident of the loop never running.

  • Re-deriving the run going downward instead of upward: walking both x - 1 and x + 1 from every value without the pruning test double-counts the same run from each of its members; the pruning check is what makes a single-direction (upward-only) walk sufficient.

  • Assuming sorted input: nums is explicitly unsorted and the algorithm never sorts it; there is no step that depends on the array's original order, only on set membership.

Senior SWE Reasoning Architecture

4-Phase Thought Process Model

Pattern Recognition Signals

The 10-second spot

"Unsorted array" plus "must run in O(n) time" rules out sorting; "longest run of consecutive values" is a question about relative adjacency (x, x + 1, x + 2, ...), not array order or index adjacency -- the Hash-Set Sequence Scanning model.

Formulating the Predicate & Invariants

Turning intuition into a boolean rule

A run is walked only from its start, the one value in it whose predecessor (left - delta) is absent from seen; every other value in the array is pruned in O(1)O(1)O(1) by that same check.

Silent Failure Traps & Edge Cases

Where confident candidates still lose points

  • seen = set(nums): duplicates must collapse first, or [5, 5, 5] could be mistaken for a run of length 3 instead of 1.

  • nums = []: handled explicitly by if not nums: return 0 -- without it, seen would still be empty and best would still correctly stay 0, but the guard makes the empty case read as intentional rather than incidental.

  • nums[i] can be negative: left - delta in seen and left + length * delta in seen both work unchanged, since Python's in makes no assumption about sign.

  • delta must be a positive integer: the start-boundary guard and the upward walk both assume delta >= 1; delta = 0 makes every value its own predecessor and delta < 0 reverses which end of a run is the "head".

The 60-Second Interview Pitch

Say this out loud before you type a single line

I'd use Hash-Set Sequence Scanning. Sorting would find the runs in O(N log N), but the problem demands O(N), so instead I put every value into a hash set, which also collapses duplicates. For each value, I ask one question: is its predecessor (left - delta, delta = 1 here) in the set? If yes, it is the middle or end of some run, and whichever value starts that run will walk through it on its own, so I skip it in O(1). If no, it is a run's start, so only then do I walk forward one delta at a time, counting the length. The reason this is still O(N) and not O(N^2) is that every value is walked past by at most one run's upward walk, the one it belongs to, so the total number of lookups across every walk, plus the one lookup per value in the outer loop, is at most 2N. I keep the best length seen across every start. The same code solves the general "longest arithmetic run with common difference delta" problem; LC 128 is just the delta = 1 case.

Big-O Invariant Derivation

Complexity & Mathematical Proof

TIME COMPLEXITY

O(N)

Look at the code: seen = set(nums) is one pass over nums, O(N)O(N)O(N) time and O(N)O(N)O(N) space for the set (duplicates collapse to one entry each, so the set holds at most NNN distinct values). for left in seen runs once per distinct value. Inside, if left - delta in seen is one O(1)O(1)O(1) average hash lookup. The while left + length * delta in seen loop only executes for values that pass the pruning check -- the start of each run -- and across every run it executes, it never revisits a value: once length has walked past a value, no other left in the outer loop reaches that value with a while loop of its own, because that value's own pruning check (left - delta in seen) was true. So every distinct value is touched by at most one for-loop iteration's own check plus at most one while-loop step, total work at most 2N hash lookups, O(N)O(N)O(N), for any fixed delta.

SPACE COMPLEXITY

O(N)

Look at the code: seen = set(nums) is one pass over nums, O(N)O(N)O(N) time and O(N)O(N)O(N) space for the set (duplicates collapse to one entry each, so the set holds at most NNN distinct values).

Pointer Invariant Transition Progression

Pointer Invariant Transition Progression
Synthesizing vector architecture diagram...
Staff+ Engineering Perspective

Senior SWE Deconstruction & Hardware Caveats

ARCHITECTURAL SIGNALS & INTERVIEW TRIGGERS

Triggers: "unsorted array", "must run in O(n) time". Sorting is ruled out, and the question is "is the next value present?": a Hash Map (here a set) answers it in one lookup.

CONSTRAINTS & BOUNDS

0≤N≤1050 \le N \le 10^50≤N≤105, values in [−109,109][-10^9, 10^9][−109,109]. Sorting costs O(Nlog⁡N)O(N \log N)O(NlogN) and is not allowed; a counting array over 2×1092 \times 10^92×109 values is impossible. Budget: O(N)O(N)O(N) time, O(N)O(N)O(N) space.

FAANG PRODUCTION TRAPS & EDGE CASES

Walking up from every value, not only from starts, is O(N2)O(N^2)O(N2) on one long run. Duplicates must not break a run ([1,0,1,2] is 3). An empty array returns 0.

Core Algorithmic State Invariants

  1. Only a Value Whose Predecessor Is Missing Starts a Walk

seen = set(nums) holds every value once. if x - 1 in seen: continue skips every value that is not the smallest member of its run, so the while loop only ever walks upward from a run's one true start.

  1. Every Value Is Visited by at Most One Walk

A value that is skipped by the start check is still counted, later, by the while loop of the run's real start. So the for loop's N checks plus the combined while loops' lookups never exceed 2N in total, which is what keeps the whole scan O(N).

Theory Context•Two Pointers & Sliding Window
MediumLC 128

Longest Consecutive Sequence (LeetCode 128)

Target Frequency:AmazonGoogleMetaMicrosoft

You get an integer array nums, in no particular order. A run is a chain of whole numbers that each exceed the one before by exactly 1 (x, x + 1, x + 2, ...). Find the longest run whose values all appear somewhere in nums, at any positions, and return how many values it holds.

Your algorithm has to finish in O(n) time.

Worked Examples

Example 1
Input:nums = [100,4,200,1,3,2]
Output:4
1000412002133425
Explanation: 1, 2, 3 and 4 all appear, so the run [1, 2, 3, 4] holds 4 values.
Example 2
Input:nums = [0,3,7,2,5,8,4,6,0,1]
Output:9
Explanation: Every value from 0 to 8 appears (0 twice), a run of 9 values.
Example 3
Input:nums = [1,0,1,2]
Output:3
Explanation: 0, 1 and 2 appear; the second 1 does not make the run longer.

⚖️Formal Constraints & Bounds

  • 0 <= nums.length <= 105

  • -109 <= nums[i] <= 109

Deep-Dive & Conceptual Insights

Core Insight

A run has exactly one value whose predecessor is missing from the set, so testing x - 1 in seen finds every run's start in O(1)O(1)O(1), and only a start is ever walked upward -- which is what keeps the whole scan linear.

Real-World Scenario & Production Applications

Compacting a set of IDs into ranges works the same way: free port numbers, allocated row IDs, or reserved seat numbers, collected in any order, fold into [start, end] blocks by the same test -- a value only opens a new block when the value one below it is not in the set.

Step-by-Step Execution Trace Table

Input nums = [100,4,200,1,3,2] (LeetCode Example 1, delta = 1). seen = {100,4,200,1,3,2}:

Stepleftleft - delta in seen?Actionlength reachedbest after the step
1100No (99 absent)Run start: walk 101 -- absent, stop11
24Yes (3 present)Not a start: skip--1
3200No (199 absent)Run start: walk 201 -- absent, stop11
41No (0 absent)Run start: walk 2✓, 3✓, 4✓, 5 absent, stop44
53Yes (2 present)Not a start: skip--4
62Yes (1 present)Not a start: skip--4
Endreturn 4: the run [1, 2, 3, 4]
Code Shape
Archetype Code Shape
Python
1A run of consecutive values has exactly one start: the value whose predecessor (`x - 1`) does not appear anywhere in the array.
2Put every value into a hash set once; for each value, check whether it is a run's start before doing any more work for it.
3`seen = set(nums)`; `for x in seen: if x - 1 in seen: continue` (skip anything that is not a start); otherwise `length = 1; while x + length in seen: length += 1`; track `best = max(best, length)`.
4The trap: skipping the `x - 1 in seen` check and walking from every value makes the scan $O(N^2)$ on one long run -- the pruning check is what keeps every value visited by at most one walk.

Conceptual Narrative

🧭 Conceptual Foundation & Pattern Intuition

A hash set answers one question in one step: "is this value here?" Finding the longest run of consecutive numbers in an unsorted array looks like it needs sorting first, but sorting spends O(Nlog⁡N)O(N \log N)O(NlogN) just to learn an ordering the problem never asks you to keep -- it only asks for the length of the longest run. A hash set gives the same "what comes next?" answer in O(1)O(1)O(1), so the real problem is not finding runs, it is finding run starts: a value is a start exactly when nothing one smaller than it exists, and once you are standing at a start, walking forward one step at a time with set lookups costs nothing extra because each value is only ever walked past once.

🏟️ The Analogy: Train Cars on a Siding, Found Out of Order

Picture rail cars numbered 1 through 9, uncoupled and shunted onto a siding in random order: car 4, then 100, then 1, then 3, then 2. A yard worker checking every car against every other car to find the longest coupled chain would take forever. Instead, she keeps a clipboard of every car number present (the hash set), and for each car asks one question: "is the car numbered one less than this one on my list?" If yes, this car is the middle or end of some chain and someone else will walk it from its front; skip it. If no, this car is a chain's front, so walk forward from it, car by car, counting how many are coupled before the chain breaks. Every car is asked "am I a front?" once, and every car is counted by a walk at most once, no matter how the cars were shunted onto the siding.

🔑 Why It Works

A run of consecutive values has exactly one smallest member, and that member is the only one in the run whose predecessor is missing from seen. So if x - 1 in seen: continue identifies, in O(1)O(1)O(1), every value that is not a run's start, and the while loop only ever fires for the one value per run that is. Across the whole array, the for loop costs NNN lookups and the combined while loops cost at most NNN more lookups, since each value is walked past by at most one run -- the one it belongs to.

  • Skipping the pruning check: walking the upward probe from every value, not only from values whose predecessor is absent, re-walks every run once per value inside it -- O(N^2) on one long run, which the problem's O(n) requirement forbids.

  • Not collapsing duplicates: iterating nums directly instead of set(nums) lets a repeated value either inflate length or waste work re-starting a walk already counted; set(nums) fixes both.

  • Forgetting the empty-array case: nums = [] must return 0; the explicit if not nums: return 0 guard makes this read as a deliberate check rather than an accident of the loop never running.

  • Re-deriving the run going downward instead of upward: walking both x - 1 and x + 1 from every value without the pruning test double-counts the same run from each of its members; the pruning check is what makes a single-direction (upward-only) walk sufficient.

  • Assuming sorted input: nums is explicitly unsorted and the algorithm never sorts it; there is no step that depends on the array's original order, only on set membership.

Senior SWE Reasoning Architecture

4-Phase Thought Process Model

Pattern Recognition Signals

The 10-second spot

"Unsorted array" plus "must run in O(n) time" rules out sorting; "longest run of consecutive values" is a question about relative adjacency (x, x + 1, x + 2, ...), not array order or index adjacency -- the Hash-Set Sequence Scanning model.

Formulating the Predicate & Invariants

Turning intuition into a boolean rule

A run is walked only from its start, the one value in it whose predecessor (left - delta) is absent from seen; every other value in the array is pruned in O(1)O(1)O(1) by that same check.

Silent Failure Traps & Edge Cases

Where confident candidates still lose points

  • seen = set(nums): duplicates must collapse first, or [5, 5, 5] could be mistaken for a run of length 3 instead of 1.

  • nums = []: handled explicitly by if not nums: return 0 -- without it, seen would still be empty and best would still correctly stay 0, but the guard makes the empty case read as intentional rather than incidental.

  • nums[i] can be negative: left - delta in seen and left + length * delta in seen both work unchanged, since Python's in makes no assumption about sign.

  • delta must be a positive integer: the start-boundary guard and the upward walk both assume delta >= 1; delta = 0 makes every value its own predecessor and delta < 0 reverses which end of a run is the "head".

The 60-Second Interview Pitch

Say this out loud before you type a single line

I'd use Hash-Set Sequence Scanning. Sorting would find the runs in O(N log N), but the problem demands O(N), so instead I put every value into a hash set, which also collapses duplicates. For each value, I ask one question: is its predecessor (left - delta, delta = 1 here) in the set? If yes, it is the middle or end of some run, and whichever value starts that run will walk through it on its own, so I skip it in O(1). If no, it is a run's start, so only then do I walk forward one delta at a time, counting the length. The reason this is still O(N) and not O(N^2) is that every value is walked past by at most one run's upward walk, the one it belongs to, so the total number of lookups across every walk, plus the one lookup per value in the outer loop, is at most 2N. I keep the best length seen across every start. The same code solves the general "longest arithmetic run with common difference delta" problem; LC 128 is just the delta = 1 case.

Big-O Invariant Derivation

Complexity & Mathematical Proof

TIME COMPLEXITY

O(N)

Look at the code: seen = set(nums) is one pass over nums, O(N)O(N)O(N) time and O(N)O(N)O(N) space for the set (duplicates collapse to one entry each, so the set holds at most NNN distinct values). for left in seen runs once per distinct value. Inside, if left - delta in seen is one O(1)O(1)O(1) average hash lookup. The while left + length * delta in seen loop only executes for values that pass the pruning check -- the start of each run -- and across every run it executes, it never revisits a value: once length has walked past a value, no other left in the outer loop reaches that value with a while loop of its own, because that value's own pruning check (left - delta in seen) was true. So every distinct value is touched by at most one for-loop iteration's own check plus at most one while-loop step, total work at most 2N hash lookups, O(N)O(N)O(N), for any fixed delta.

SPACE COMPLEXITY

O(N)

Look at the code: seen = set(nums) is one pass over nums, O(N)O(N)O(N) time and O(N)O(N)O(N) space for the set (duplicates collapse to one entry each, so the set holds at most NNN distinct values).

Pointer Invariant Transition Progression

Pointer Invariant Transition Progression
Synthesizing vector architecture diagram...
Staff+ Engineering Perspective

Senior SWE Deconstruction & Hardware Caveats

ARCHITECTURAL SIGNALS & INTERVIEW TRIGGERS

Triggers: "unsorted array", "must run in O(n) time". Sorting is ruled out, and the question is "is the next value present?": a Hash Map (here a set) answers it in one lookup.

CONSTRAINTS & BOUNDS

0≤N≤1050 \le N \le 10^50≤N≤105, values in [−109,109][-10^9, 10^9][−109,109]. Sorting costs O(Nlog⁡N)O(N \log N)O(NlogN) and is not allowed; a counting array over 2×1092 \times 10^92×109 values is impossible. Budget: O(N)O(N)O(N) time, O(N)O(N)O(N) space.

FAANG PRODUCTION TRAPS & EDGE CASES

Walking up from every value, not only from starts, is O(N2)O(N^2)O(N2) on one long run. Duplicates must not break a run ([1,0,1,2] is 3). An empty array returns 0.

Core Algorithmic State Invariants

  1. Only a Value Whose Predecessor Is Missing Starts a Walk

seen = set(nums) holds every value once. if x - 1 in seen: continue skips every value that is not the smallest member of its run, so the while loop only ever walks upward from a run's one true start.

  1. Every Value Is Visited by at Most One Walk

A value that is skipped by the start check is still counted, later, by the while loop of the run's real start. So the for loop's N checks plus the combined while loops' lookups never exceed 2N in total, which is what keeps the whole scan O(N).

© 2026 Hi👋WebEnterprise. All rights reserved.
Sitemap•llms.txt•