Array / String / Guided Learning Track

Array / String

Explore greedy scans, Roman numeral transforms, string packing, substring search, whitespace normalization, and other array/string patterns through guided lesson flows built on top of the original visualizer engine.

Flagship Guided Lesson

Best Time to Buy and Sell Stock II

This lesson now includes dynamic why coaching, mistake detection, replay variations, pattern guidance, and adaptive next-step recommendations.

Best Time to Buy and Sell Stock II

Medium

Trace every profitable upward price edge and accumulate unlimited transaction profit.

Array / String / Greedy Profit

Open guided lesson

Best Time to Buy and Sell Stock

Easy

Scan prices once, keep the cheapest buy day seen so far, and evaluate every later day as a possible sell.

Array / String / Greedy Profit

Open lesson

Candy

Hard

Distribute the fewest candies by enforcing rating inequalities once from the left and once from the right.

Array / String / Greedy Two-Pass Constraints

Open lesson

Find the Index of the First Occurrence in a String

Easy

Return the first index where the needle appears in the haystack by testing candidate windows left to right.

Array / String / Substring Search / Sliding Alignment

Open lesson

Gas Station

Medium

Find the unique start index by combining a global balance check with a local running tank that resets on failure.

Array / String / Greedy Circuit Proof

Open lesson

H-Index

Medium

Sort citations in descending order and locate the largest threshold where citations[i] still supports h = i + 1.

Array / String / Threshold Logic

Open lesson

Insert Delete GetRandom O(1)

Medium

Replay a full RandomizedSet operation log and watch how the dense array and hashmap cooperate to preserve average O(1) operations.

Array / String / Hashmap + Array

Open lesson

Integer to Roman

Medium

Convert an integer into a Roman numeral by greedily minting the largest denomination that still fits the remaining value.

Array / String / Greedy Denominations / Roman Numerals

Open lesson

Jump Game II

Medium

Interpret the array as BFS layers: currentEnd closes the current jump window, and farthest builds the next one.

Array / String / Minimum Jump Layers

Open lesson

Jump Game

Medium

Keep a single farthest-reachable frontier and decide whether the last index ever becomes reachable.

Array / String / Greedy Frontier

Open lesson

Length of Last Word

Easy

Return the length of the last word in a string by scanning from the end, trimming spaces, and counting the final non-space stretch.

Array / String / Reverse Scan / Whitespace

Open lesson

Longest Common Prefix

Easy

Find the longest shared prefix across a list of strings by comparing one character column at a time.

Array / String / Prefix Scan / Column Comparison

Open lesson

Majority Element

Easy

Watch Boyer-Moore pair off competing values until the majority element remains as the final survivor.

Array / String / Voting Invariant

Open lesson

Merge Sorted Array

Easy

Merge two sorted arrays directly into nums1 and watch how the rightmost free slot makes in-place merging safe.

Array / String / In-Place Merge

Open lesson

Product of Array Except Self

Medium

Compute the product for every index without division by first storing left products and then multiplying in right products.

Array / String / Prefix and Suffix Products

Open lesson

Remove Duplicates from Sorted Array II

Medium

Keep a valid prefix where every value appears at most twice, using the write-2 lookback to block third copies.

Array / String / Bounded Duplicates

Open lesson

Remove Duplicates from Sorted Array

Easy

Use the sorted order to keep a compact unique prefix and skip repeated values with a single comparison.

Array / String / Sorted Array Prefix

Open lesson

Remove Element

Easy

Compact every non-target value into the front of the array and treat the remaining tail as irrelevant.

Array / String / In-Place Filtering

Open lesson

Reverse Words in a String

Medium

Normalize the input into clean tokens, then rebuild the sentence from the last token back to the first with exactly one space between words.

Array / String / Tokenization / Reverse Assembly

Open lesson

Roman to Integer

Easy

Convert a Roman numeral into an integer by comparing each glyph to its immediate lookahead and turning it into a signed contribution.

Array / String / Roman Numerals / Lookahead

Open lesson

Rotate Array

Medium

Rotate right by k steps using the classic reverse-all, reverse-front, reverse-back strategy.

Array / String / Reversal Trick

Open lesson

Text Justification

Hard

Greedily pack words into each line, distribute the remaining spaces across the gaps, and left-justify the final line.

Array / String / Greedy Packing / Formatting

Open lesson

Trapping Rain Water

Hard

Count trapped water in one pass by always resolving the shorter side and maintaining left and right boundary maxima.

Array / String / Two-Pointer Boundary Maxima

Open lesson

Zigzag Conversion

Medium

Route characters through a bouncing row pointer, then read the row buffers back in order to form the zigzag-converted string.

Array / String / Simulation / Zigzag Routing

Open lesson