practice a little every day — you've got this ♡
Greedy & Intervals Interview Problems
Practice 5969 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5969
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 31–60 of 161 results
- Greedy & IntervalsEasyAuto-gradedTill Payout: Greedy Bills and Coins, Listed A to Z
Parse decimal money strings exactly into cents, detect underpayment or exact payment, then greedily break the change into named bills and coins and output them sorted alphabetically.
Greedy & Intervalsgreedystringsparsingsorting - Greedy & IntervalsMediumAuto-gradedMinimum Time Slots for Cooldown-Constrained Jobs
Compute the shortest timeline needed to run labeled jobs when equal labels must be separated by a cooldown, using frequency counting and a greedy frame argument.
Greedy & Intervalsgreedycountingschedulingmath - Greedy & IntervalsEasyAuto-gradedSettle Shared Expenses With a Two-Pointer Payment Plan
Turn a map of net balances into a deterministic list of payments that zeroes every account, using a sorted two-pointer greedy match between debtors and creditors.
Greedy & Intervalsgreedytwo-pointershash-mapsorting - Greedy & IntervalsMediumAuto-gradedCombine Two Ordered Schedules into One Gap-Free Timeline
Merge two sorted lists of internally disjoint closed intervals into one sorted, disjoint list, joining overlapping or endpoint-touching intervals, in linear time.
Greedy & Intervalsintervalstwo-pointersmergesweep-line - Greedy & IntervalsMediumAuto-gradedFewest Rooms to Host All Bookings
Find the smallest number of rooms that can host every booking at once, where a booking may begin the moment another one ends, using sorting and a min-heap.
Greedy & Intervalsintervalsmin-heapsortinggreedy - Greedy & IntervalsMediumAuto-gradedFewest Segment Boosts to Make a Sequence Non-Decreasing
Compute the minimum number of +1 contiguous-segment updates needed to make an array non-decreasing, using adjacent differences and a lower-bound argument.
Greedy & Intervalsdifference-arraygreedyarraysrange-updates - Greedy & IntervalsMediumAuto-gradedFewest Steps on a Faulty Calculator: Decrement or Double
Find the minimum number of decrement-by-one and double operations needed to turn one positive integer into another, which rewards working backward from the target with a greedy rule.
Greedy & Intervalsgreedymathreverse-thinking - Greedy & IntervalsEasyAuto-gradedFilter Financial Logs by Active Premium Periods
Filter a chronological sequence of transaction records based on whether they fall within active premium membership intervals.
Greedy & Intervalsintervalsdata-filteringhash-table - Greedy & IntervalsEasyAuto-gradedPartition Array Under Segment Capacity Limit
Determine the minimum number of contiguous segments needed to split an array such that no segment's total sum exceeds a specified capacity limit.
Greedy & Intervalsarraysgreedy - Greedy & IntervalsMediumAuto-gradedLongest Streak of Growing Daily Distinct Picks
Find how many days a growing-size distinct-item picking schedule can run, using binary search on the answer plus a capacity feasibility check.
Greedy & Intervalsgreedybinary-searchprefix-sumsfeasibility-check - Greedy & IntervalsHardAuto-gradedSimulate Trading Order Fill Rate Limit
Simulate order executions under a time-windowed volume participation constraint using a sliding window.
Greedy & Intervalssliding-windowqueuegreedytime-series - Greedy & IntervalsMediumAuto-gradedCollapse Booking Windows into Non-Touching Blocks
Merge inclusive ranges that share at least one point into a sorted list of disjoint ranges, testing sorting, a linear sweep, and correct handling of touching endpoints and nesting.
Greedy & Intervalsintervalssortingsweepgreedy - Greedy & IntervalsMediumAuto-gradedLargest Group Anchored by One Overlapping Interval
Find the largest set of intervals that all intersect one chosen anchor interval, using sorting and binary search to beat quadratic time.
Greedy & Intervalsintervalsbinary-searchsortingcounting - Greedy & IntervalsMediumAuto-gradedFewest Brackets to Add for a Balanced String
Count the fewest parenthesis insertions needed to make a string of brackets balanced, using a single left-to-right pass with a running counter.
Greedy & Intervalsgreedystringsparenthesescounter - Greedy & IntervalsMediumAuto-gradedLargest Number With Even Counts of Both Digits
Delete characters from a string of 1s and 2s so both digit counts are even and the number is largest, testing greedy deletion with parity reasoning.
Greedy & Intervalsgreedystringstacksubsequence - Greedy & IntervalsMediumAuto-gradedBiggest Cabin Party Respecting Everyone's Companion Limits
Find the largest group size k where at least k people accept exactly k-1 companions, using interval counting with a difference array in linear time.
Greedy & Intervalsdifference-arrayintervalscountingprefix-sum - Greedy & IntervalsMediumAuto-gradedEven Budget Split Under Per-Person Caps
Split a budget as evenly as possible among people with individual caps, using a binary-searched fill level plus a lowest-index-first remainder rule.
Greedy & Intervalsgreedybinary-searchwater-fillingarrays - Greedy & IntervalsMediumAuto-gradedCombine Overlapping Ranges and Count Unique Land Shapes
Merge overlapping or touching closed ranges, and count land regions in a binary grid that differ in shape when only shifting is allowed.
Greedy & Intervalsintervalssortingdfsgrid - Greedy & IntervalsMediumAuto-gradedMinimum Resources Required for Scheduled Jobs
Determine the minimum number of resources required to run a schedule of tasks given start and end times with boundary reuse allowed.
Greedy & Intervalsgreedy-intervalsheaps-sortingarrays - Greedy & IntervalsMediumAuto-gradedFewest Conference Rooms for a Day of Bookings
Find the fewest rooms that can host every booking in an unordered list of half-open time ranges, where back-to-back bookings may share a room.
Greedy & Intervalsintervalssweep-linesortinggreedy - Greedy & IntervalsMediumAuto-gradedCount Total Pipeline Output Within Time Constraint
Compute the maximum number of items processed by a sequential single-threaded worker within a total allowed time limit.
Greedy & Intervalsgreedyarraysmath - Greedy & IntervalsEasyAuto-gradedDoes a New Booking Collide With Existing Slots?
Decide whether a proposed half-open time slot shares any time with a list of unsorted booked slots, testing overlap logic and correct handling of touching endpoints.
Greedy & Intervalsintervalsoverlaphalf-openlinear-scan - Greedy & IntervalsMediumAuto-gradedText Formatting and Dynamic Schedule Tracker
Perform greedy text wrapping to fixed line widths alongside dynamic interval point queries with insertion and removal.
Greedy & Intervalsgreedyintervalsfenwick-treecoordinate-compression - Greedy & IntervalsMediumAuto-gradedCalculate Max Trading Returns from Multi-Asset Feed
Process an unordered multi-asset market feed to find the maximum possible cumulative profit across all tickers.
Greedy & Intervalsarraysgreedysortinghash-map - Greedy & IntervalsEasyAuto-gradedExtract Continuous Active Time Windows
Process chronological sensor sample logs to extract continuous active periods matching a minimum elapsed duration requirement.
Greedy & Intervalsgreedy-intervalsarraystwo-pointers - Greedy & IntervalsMediumAuto-gradedWildcard Brackets: Can the Sequence Be Made Valid?
Decide if a string of brackets and wildcards can be made valid by choosing each wildcard's role, testing range-tracking of reachable open counts or a greedy two-pass argument.
Greedy & Intervalsgreedystringsparenthesesdynamic-programming - Greedy & IntervalsEasyAuto-gradedSummarize Integer Ranges into String
Process an unorganized array of integers by sorting, deduplicating, and formatting contiguous numerical ranges into a compact string.
Greedy & Intervalsarrayssortingintervalsstrings - Greedy & IntervalsMediumAuto-gradedCollapse Booked Time Slots into Disjoint Blocks
Combine a list of [start, end] ranges so that any that overlap or touch become one range, using sorting and a single sweep.
Greedy & Intervalsintervalssortinggreedyarrays - Greedy & IntervalsEasyAuto-gradedMinimum Days to Complete Sequential Tasks With Daily Time Budgets
Greedy single-pass simulation: pack tasks in order into daily time budgets without splitting, and return the day count or -1 if impossible.
Greedy & Intervalsgreedysimulationtwo-pointersarrays - Greedy & IntervalsMediumAuto-gradedRoom Count and Heaviest Prerequisite Chain for Sessions
Combine an interval-overlap sweep with a min-heap and a longest weighted path on a DAG using topological order.
Greedy & Intervalsintervalsmin-heaptopological-sortdag