HARDasked at 1 company

Find Building Where Alice and Bob Can Meet

A hard-tier problem at 52% community acceptance, tagged with Array, Binary Search, Stack. Reported in interviews at Infosys and 0 others.

Founder's read

Alice and Bob need to meet at a building, but they're coming from opposite ends of a street lined with buildings of varying heights. The catch: they can only move to a building that's taller than or equal to their current position, and they need to find the spot where both can arrive. This problem looks deceptively simple on the surface, but it's asked at places like Infosys and sits at a 52% acceptance rate for a reason. Most candidates nail the brute force, then realize their solution times out. The algorithmic trick isn't obvious, and if you blank on optimization during the live OA, StealthCoder solves it in seconds invisible to the proctor.

Companies asking
1
Difficulty
HARD
Acceptance
52%

Companies that ask "Find Building Where Alice and Bob Can Meet"

If this hits your live OA

Find Building Where Alice and Bob Can Meet is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The naive approach is to simulate both Alice and Bob moving inward from their starting positions, comparing building heights at each step. That works for small arrays but fails on large inputs. The real pattern involves recognizing that you need to track the maximum height seen so far from each direction, then find the building where both can meet. Binary Search fits naturally here, or you can solve it with a two-pointer sweep and careful state tracking. The tricky part isn't the algorithm itself, it's avoiding the off-by-one errors and recognizing when the optimal building is determined by constraints from both directions simultaneously. Stack and monotonic data structures can optimize certain comparisons, but the core insight is directional maxima. If you hit this live and the brute force doesn't pass within the time limit, StealthCoder surfaces a working optimized solution without the proctor seeing your screen.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Find Building Where Alice and Bob Can Meet recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find Building Where Alice and Bob Can Meet interview FAQ

Is this a greedy problem or does it need dynamic programming?+

Neither. It's a constraint satisfaction problem disguised as movement simulation. You need to track what positions are reachable from each direction given height constraints, then find the intersection. Binary Search or two-pointer sweeps are the practical approaches, not greedy or DP.

Why does the obvious simulation approach fail?+

It works for small inputs but has quadratic or worse time complexity when you recalculate reachability for each potential meeting point. You need to precompute directional reachability or use a technique like binary search on the answer to avoid redundant comparisons.

What's the actual trick this problem is testing?+

Recognizing that you can solve it in one or two passes rather than nested loops. Many candidates miss that the problem has optimal substructure in one direction, and that computing the maximum height seen so far from each end simplifies the meeting point check dramatically.

How does this relate to the other array and binary search topics?+

Array iteration and comparison is baseline. Binary Search applies when you realize you can narrow the search space of candidate meeting points. Stack and monotonic structures help optimize the directional sweep if the constraint graph gets complex, but they're not always necessary.

Is a 52% acceptance rate normal for Infosys questions, or is this harder than typical?+

It's on the harder side for acceptance rate. Most medium problems sit 50-65% pass. This one likely has a high time-limit timeout rate and off-by-one error rate, meaning many candidates solve it logically but implement inefficiently or incorrectly on first try.

Want the actual problem statement? View "Find Building Where Alice and Bob Can Meet" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.