Problems
Problems unlock as the flowchart engine gains the features they need. Locked problems show which capabilities are missing.
- ALG-E001Easy
Sum the Readings
Return the sum of all integers in numbers. An empty list has a sum of zero.
Arrays
- ALG-E002Easy
Count Even Readings
Count how many numbers are divisible by two. Zero and negative even integers count.
Loops
- ALG-E003Easy
Highest Sensor Value
Find the greatest integer in the non-empty numbers array.
Arrays
- ALG-E004Easy
First Matching Position
Return the zero-based index of the first occurrence of target. Return -1 if target is absent.
Arrays
- ALG-E005Easy
Reverse the Message
Return text with all characters in reverse order. Preserve capitalization, spaces, and punctuation.
Strings
- ALG-E006Easy
Mirror Word Check
Return true when text reads identically forward and backward. The comparison is case-sensitive and includes spaces.
Strings
- ALG-E007Easy
Vowel Counter
Count the English vowels a, e, i, o, u in text. Uppercase and lowercase vowels count equally; y does not count.
Strings
- ALG-E008EasyComing soon
Count Different Codes
Return the number of distinct integer values in numbers. Count each unique value once.
Hashing
- ALG-E009Easy
Sorted Order Check
Return true if each element is less than or equal to the element immediately after it. Empty and one-element arrays are sorted.
Arrays
- ALG-E010Easy
Frequency of a Code
Count the number of positions whose value equals target.
Arrays
- ALG-E011Easy
Running Energy Total
Return an array where each position contains the sum of all readings up to and including that position.
Prefix Sum
- ALG-E012Easy
Merge Two Sensor Logs
Merge two individually non-decreasing integer arrays into one non-decreasing array, keeping every occurrence.
Two Pointers
- ALG-E013EasyComing soon
First Pair Matching a Target
Find two distinct indices i and j with i < j whose values sum to target. Return the lexicographically smallest pair [i,j], or [-1,-1] when no pair exists.
Hashing
- ALG-E014Easy
First Position in Sorted Data
In a non-decreasing array, return the first index containing target, or -1 if target is absent. Repeated values must return the earliest index.
Binary Search
- ALG-E015Easy
Rotate the Queue
Return the array rotated right by k positions. A rotation moves the last value to the front; an empty array remains empty.
Arrays
- ALG-E016Easy
Missing Sequence Identifier
numbers contains every integer from 0 through n except exactly one, where n is the array length. Return the missing integer.
Math
- ALG-E017Easy
Longest Online Streak
Given an array containing only 0 and 1, find the longest contiguous run of 1 values.
Arrays
- ALG-E018Easy
Compact Nonzero Values
Move all zeros to the end of the array while preserving the relative order of nonzero values. Return the resulting array.
Two Pointers
- ALG-E019Easy
Runner-Up Measurement
Return the second-largest distinct integer in numbers. Return null when fewer than two distinct values exist.
Arrays
- ALG-E020Easy
Multiples Label Generator
For each integer from 1 to n, return Fizz when divisible by 3, Buzz when divisible by 5, FizzBuzz when divisible by both, otherwise its decimal string.
Loops
- ALG-M001MediumComing soon
Best Single Trade
Given prices for consecutive days, buy on one day and sell on a strictly later day to maximize profit. Return 0 if no positive profit exists.
Greedy
- ALG-M002MediumComing soon
Longest Unique-Character Window
Return the maximum length of a contiguous substring that contains no repeated characters. An empty string returns zero.
Sliding Window
- ALG-M003MediumComing soon
Bracket Sequence Validator
The input contains only (), [], and {} symbols. Return true when every opening bracket is closed by the matching type in correct nesting order.
Stack
- ALG-M004MediumComing soon
Product of Other Positions
Return an array where result[i] equals the product of all input values except numbers[i]. Use exact integer arithmetic, including zeros.
Prefix/Suffix
- ALG-M005MediumComing soon
Count Target-Sum Subarrays
Count non-empty contiguous subarrays whose sum equals target. Negative numbers and zero are allowed.
Prefix Sum
- ALG-M006MediumComing soon
Shortest Sufficient Segment
Given positive integers and a positive target, return the minimum length of a contiguous subarray whose sum is at least target. Return 0 if none exists.
Sliding Window
- ALG-M007MediumComing soon
Consolidate Time Windows
Merge all closed intervals that overlap or touch at an endpoint. Return merged [start,end] pairs sorted by starting coordinate.
Intervals
- ALG-M008MediumComing soon
Find in a Rotated Log
A strictly increasing array was rotated around a pivot. Return the index of target, or -1 when absent. All values are distinct.
Binary Search
- ALG-M009MediumComing soon
Clockwise Matrix Walk
Return the entries of a rectangular integer matrix in clockwise spiral order, starting at its top-left corner and moving right first.
Matrix
- ALG-M010MediumComing soon
Build Pascal Layers
Return the first rows rows of Pascal's triangle. Each row starts and ends with 1; interior entries are the sum of the two entries above.
Dynamic Programming
- ALG-M011MediumComing soon
Longest Mirrored Segment
Return the longest contiguous palindromic substring of text. If multiple have the same maximum length, return the one with the smallest starting index.
Two Pointers
- ALG-M012MediumComing soon
Zigzag Message Layout
Write characters into the specified number of rows by moving down one row at a time, then up diagonally, repeating at boundaries. Return the concatenation of rows from top to bottom.
Simulation
- ALG-M013MediumComing soon
Most Common Signal Codes
Return the k distinct values with highest frequency. Order by descending frequency, then by ascending numeric value for ties.
Hashing
- ALG-M014MediumComing soon
Next Higher Reading
For each index, find the value of the first strictly greater element to its right. Return -1 when no greater value exists.
Monotonic Stack
- ALG-M015MediumComing soon
Fewest Tokens for a Sum
Given positive coin denominations (unlimited supply of each), return the fewest coins needed to total amount exactly. Return -1 if impossible.
Dynamic Programming
- ALG-M016MediumComing soon
Count Land Regions
A rectangular grid uses 1 for land and 0 for water. Count connected land regions using only up, down, left, and right adjacency.
Graph Traversal
- ALG-M017MediumComing soon
Shortest Warehouse Walk
In a rectangular grid, 0 means walkable and 1 blocked. Find the minimum number of four-direction moves from top-left to bottom-right. Return -1 if impossible.
Breadth-First Search
- ALG-M018MediumComing soon
Equal Load Split
Return true if the nonnegative values can be divided into two groups with exactly the same sum. Every input element must belong to one group.
Dynamic Programming
- ALG-M019MediumComing soon
Longest Rising Trend
Find the length of the longest strictly increasing subsequence. Elements in a subsequence retain original order but need not be adjacent.
Binary Search
- ALG-M020MediumComing soon
Unique Zero-Sum Trios
Find all unique value triplets [a,b,c] from distinct positions that sum to zero. Sort numbers inside each triplet ascending, then return triplets in lexicographic order without duplicates.
Two Pointers
- ALG-H001HardComing soon
Median Across Sorted Streams
Two non-decreasing integer arrays are given and at least one is non-empty. Return the median of all their values, as a number, without relying on a complete merge for the intended optimal approach.
Binary Search
- ALG-H002HardComing soon
Minimum Text Edits
Return the minimum number of single-character insertions, deletions, or substitutions needed to transform a into b. Each operation costs one.
Dynamic Programming
- ALG-H003HardComing soon
Longest Correct Bracket Segment
The text contains only parentheses. Return the length of the longest contiguous substring that is a properly balanced parenthesis sequence.
Stack
- ALG-H004HardComing soon
Water Between Barriers
Each nonnegative array value is the height of a unit-width wall. Return how many unit squares of water are trapped above the bars after rainfall.
Two Pointers
- ALG-H005HardComing soon
Smallest Covering Substring
Find the shortest contiguous substring of text containing every character of required with at least the same multiplicity. Return the earliest window among ties, or an empty string if none exists. Empty required yields an empty string.
Sliding Window
- ALG-H006HardComing soon
Largest Rectangle in a Skyline
Given nonnegative heights for adjacent unit-width histogram bars, return the largest rectangular area that fits entirely under the bars.
Monotonic Stack
- ALG-H007HardComing soon
Peak Value per Window
Return the maximum element of every contiguous window of exactly k elements, ordered by the window starting index.
Deque
- ALG-H008HardComing soon
One-Letter Word Route
Transform start into end by changing exactly one lowercase letter per step; every intermediate word and end must appear in dictionary. Return the number of words in the shortest sequence, including endpoints; return 0 if impossible. If start equals end, return 1.
Graph Traversal
- ALG-H009HardComing soon
Cheapest Route with Stop Limit
For directed flights [from,to,cost], find the least total cost from source to destination using at most max_stops intermediate cities (thus at most max_stops+1 edges). Return -1 if impossible.
Graphs
- ALG-H010HardComing soon
Least-Cost Directed Path
Given n nodes and directed edges [u,v,weight] with nonnegative weights, return the least cost from source to destination, or -1 when unreachable.
Graphs
- ALG-H011HardComing soon
Strongly Connected Zones
In a directed graph, count maximal groups where every node can reach every other node within the same group. Isolated nodes each form a group.
Graphs
- ALG-H012HardComing soon
Smallest Valid Task Schedule
For tasks numbered 0 through n-1, directed edge [u,v] requires u before v. Return the lexicographically smallest valid full ordering, or [] if dependencies contain a cycle.
Graphs
- ALG-H013HardComing soon
Count Nonattacking Queen Layouts
Place n queens on an n-by-n board so no two share a row, column, or diagonal. Return the number of different valid placements.
Backtracking
- ALG-H014HardComing soon
Full Pattern Matcher
Return whether pattern matches the entire text. A dot matches any one character; * means zero or more repetitions of the immediately preceding pattern token. All other lowercase letters match literally.
Dynamic Programming
- ALG-H015HardComing soon
Wildcard Filename Rule
Return whether pattern matches the entire text. ? matches any one character; * matches any sequence including empty; other characters match themselves.
Dynamic Programming
- ALG-H016HardComing soon
Longest Mirror Subsequence
Return the length of the longest subsequence of text that reads the same forward and backward. Characters may be skipped without changing order.
Dynamic Programming
- ALG-H017HardComing soon
Maximum Balloon Burst Score
Burst balloons in any order. When balloon i bursts, score the product of its current immediate left neighbor, its own value, and its current immediate right neighbor. Missing neighbors count as 1. Return the maximum total score.
Interval DP
- ALG-H018HardComing soon
Largest Solid Rectangle
Return the area of the largest all-1 axis-aligned rectangle in a rectangular binary grid. Return 0 for an empty grid or no 1 cells.
Matrix
- ALG-H019HardComing soon
Fewest Palindrome Splits
Split text into contiguous non-empty palindromic pieces using as few cuts as possible. Return the number of cuts. Empty text needs zero cuts.
Dynamic Programming
- ALG-H020HardComing soon
Critical Network Links
In an undirected graph, return all edges whose removal increases the number of connected components. Represent every bridge as [smaller_node, larger_node] and sort all bridges lexicographically.
Graphs