Topic
Greedy & Intervals interview problems
Scheduling, interval merging and exchange arguments. 181 original problems, each with hidden test cases you can run in the browser.
24 easy144 medium13 hard
Showing 61–90 of 181 results
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.
Auto-gradedgreedystringsparenthesesdynamic-programmingProcess an unorganized array of integers by sorting, deduplicating, and formatting contiguous numerical ranges into a compact string.
Auto-gradedarrayssortingintervalsstringsCombine a list of [start, end] ranges so that any that overlap or touch become one range, using sorting and a single sweep.
Auto-gradedintervalssortinggreedyarraysFind exactly which cluster nodes are bad when the only probe is a group test that fails if any member is bad, parallel probes must be disjoint, and each probe needs at least two nodes.
Model answergroup-testingadaptive-algorithmsround-robin-schedulingidentifiabilityGreedy single-pass simulation: pack tasks in order into daily time budgets without splitting, and return the day count or -1 if impossible.
Auto-gradedgreedysimulationtwo-pointersarraysCombine an interval-overlap sweep with a min-heap and a longest weighted path on a DAG using topological order.
Auto-gradedintervalsmin-heaptopological-sortdagCompute unreserved time windows for specified daily schedules given opening hours and existing bookings.
Auto-gradedintervalssortingstringgreedyGiven timed runs between named stops, find the fewest shuttles needed when each shuttle can only continue from the stop where its previous run ended.
Model answersweep-linesortingeventsgreedySweep over span boundaries with a heap to resolve overlapping inclusive edit spans using priority, original length, and input order, splitting losers into fragments.
Auto-gradedintervalssweep-lineheaptie-breakingParse weekday and 24-hour time strings, then merge touching or overlapping same-day bookings and output them in a canonical, sorted string format.
Auto-gradedintervalssortingstring-parsingmerge-intervalsTwo coding tasks: a one-tick bird movement function with inclusive bounds, and a greedy block builder that scores transactions together with their unconfirmed ancestors.
Model answergreedytopological-sortcycle-detectionsimulationMerge each user's subscription intervals, then attribute purchases to the merged windows, count September active days, and report out-of-window and overlap anomalies.
Auto-gradedintervalsmerge-intervalshash-mapdatetimeDetermine the maximum collection of items that can be purchased given individual item costs and a total spending limit.
Auto-gradedgreedysortingarraysDetermine the maximum number of recorded logs occurring within a contiguous time interval using a sliding window approach.
Auto-gradedsliding-windowtwo-pointersarraysintervalsConvert weekly recurring allow and freeze windows from local time zones to UTC, subtract the freezes, and list the first usable slots after a notice period.
Auto-gradedintervalssweep-linetime-zonesmodular-arithmeticCompute a total bill over a half-open time window where disjoint special-rate windows replace the default hourly rate, testing interval clipping and boundary handling.
Auto-gradedintervalssweepmatharraysEvaluate interval concurrency to determine if single-resource scheduling is possible and calculate peak concurrent demand.
Auto-gradedintervalssortingheapsweep-lineRotate a square grid 90 degrees clockwise and identify regions of maximal overlapping intervals using a sweep-line algorithm.
Model answerarraysgreedy-intervalsheaps-sortingIncorporate a target range into an already sorted list of disjoint closed intervals, merging any overlapping or adjacent spans in linear time.
Auto-gradedintervalsarraysgreedyFind the maximum number of intervals that belong to a single connected component where edges represent inclusive interval overlaps.
Auto-gradedintervalssortinggreedygraphsChoose exactly k items for the first worker to maximize total payoff, which tests reducing a problem to per-item differences and greedy top-k selection.
Auto-gradedgreedysortingarraysexchange-argumentFind the earliest meeting slot of a given length that fits inside everyone's availability window and avoids every busy block, by intersecting windows and merging busy intervals.
Auto-gradedintervalssweep-linesortingschedulingJoin two record lists by id, group event time ranges by locality, merge overlapping or touching ranges, and return the merged windows in a specified sort order.
Auto-gradedintervalsmerge-intervalshash-mapsortingDesign a scalable real-time engine that matches couriers to incoming delivery requests, defining the cost model, candidate pruning, matching method, complexity, and failure handling.
Model answermatchinggreedyspatial-indexreal-timeTests the greedy earliest-finish strategy: find the fewest ranges to discard so the rest share no interior points, with touching endpoints allowed.
Auto-gradedgreedyintervalssortinginterval-schedulingFind the peak number of simultaneously active half-open intervals using a sweep line or heap, with correct handling of ties where one booking ends as another begins.
Auto-gradedintervalssweep-linesortingheapTrack an IPv4 block as disjoint integer intervals while applying ordered allow and deny CIDR rules, deciding whether the block ends up fully covered with no deny hit.
Auto-gradedintervalsipv4cidrsimulationSweep over unsorted start/end events to total concurrency-weighted seconds, validate malformed input, and convert to a half-up rounded dollar string.
Auto-gradedinterval sweepevent sortingvalidationexact arithmeticCompute the minimum skips each depot needs using modular arithmetic, then greedily pick the cheapest depots under a shared skip budget to maximize emptied depots.
Auto-gradedgreedymathsortingmodular-arithmeticFind the largest gain from buying on one day and selling on a later day in a list of daily prices, returning 0 if no gain is possible.
Auto-gradedgreedyarraysrunning-minimumsingle-pass