← Swiggy questions

Vertical line crossing the most segments

Filed under Swiggy

You are given N horizontal segments, each as (x_start, x_end, y). Choose a vertical line x = c that intersects the maximum number of segments (endpoints count as touching). Return c and the…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Swiggy questions

Collected from public candidate posts and coding forums. Updated Nov 2026.