Target Interval Conflict
Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Google OA reported in September 2026 looks like an interval problem, but it's really one comparison inside a loop. Given a target half-open interval and an unsorted pile of others, you say whether any of them overlaps. No merging, no sorting, no sweep line. If you've been bracing for something hard, relax a little. If you blank on the overlap condition under pressure, StealthCoder can run invisibly during the live assessment and hand you the check. The array pattern is the whole story here, and the only real risk is getting the boundary wrong.
The problem
You are given a target half-open interval [target[0], target[1]) and an unsorted collection of half-open intervals intervals. Return true if the target conflicts with at least one interval. Otherwise, return false. Two half-open intervals conflict when they share at least one point. Endpoints that only touch are not a conflict. Equivalently, [aStart, aEnd) and [bStart, bEnd) do not conflict when aEnd <= bStart or bEnd <= aStart. This is a single query. The input does not need to be sorted. Function hasIntervalConflict(target: int[], intervals: int[][]) → boolean Examples Example 1 target = [4,8] intervals = [[8,10],[1,4],[6,7]] return = true The intervals [1,4) and [8,10) only touch the target at an endpoint, but [6,7) shares points with [4,8). Example 2 target = [4,8] intervals = [[10,12],[1,4],[8,10]] return = false Every interval is disjoint from the target. In particular, [1,4) ends when the target begins, and [8,10) begins when the target ends. Constraints target.length == 2. Every row of intervals has length 2. Every target and collection interval is valid: start < end. intervals may be empty and may appear in any order.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is to flip the question. Instead of defining overlap, define non-overlap, which the problem hands you: two intervals are disjoint when aEnd <= bStart or bEnd <= aStart. So a conflict is the negation: target[0] < end and start < target[1]. Loop through every interval, return true on the first one that satisfies that, and return false after the loop. That's O(n) time and O(1) space, and an empty list returns false naturally. The common pitfall is using <= instead of <, which turns touching endpoints into conflicts and breaks both examples. Example 1 only returns true because of [6,7), not [1,4) or [8,10). Sorting first is wasted effort for a single query. If the boundary logic slips on the live OA, StealthCoder is the safety net that shows the correct condition so you can type it and move on.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Target Interval Conflict cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Google's OA.
Google reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Target Interval Conflict FAQ
How hard is the Target Interval Conflict problem really?+
Easy. It's a single linear scan with one boolean condition. The difficulty is entirely in getting the strict inequalities right. If you can explain why touching endpoints don't count for half-open intervals, you've solved the hard part of it.
What's the trick to solving it fast?+
Write the disjoint condition from the statement, then negate it. Disjoint is aEnd <= bStart or bEnd <= aStart. Conflict is target start < interval end AND interval start < target end. Loop and return true on the first match.
Do I need to sort the intervals?+
No. The statement says this is a single query and the input is unsorted. Sorting costs O(n log n) and buys you nothing. A plain scan is O(n) and can exit early the moment it finds an overlap.
What edge cases should I test?+
Test an empty intervals list, which should return false. Test intervals that touch the target at either end, which should also return false. Then test one interval fully inside the target and one that fully contains it. Both should return true.
How do I prepare for this in 48 hours?+
Don't grind. Write the overlap check from memory a few times, then run both examples by hand. Spend the rest of your time on other interval problems like merging and inserting, since OAs often pair an easy one with a harder one.