2daysbeforeinterview
Home1Companies2Problems3Experiences4Compensation5Assistant

Spaces

Saved work

Your prep

Notes6Bookmarks7Submissions

Community

Leaderboard8Send feedback
Contribute9
2daysbeforeinterview
2daysbeforeinterview

Straight from the interview room.

Browse

  • Companies
  • Problems
  • Experiences
  • Compensation
  • Leaderboard
  • Pricing

Contribute

  • Add a question
  • Share an experience
  • Report compensation
  • Committed Contributor
  • Send feedback

About

  • About 2daysbeforeinterview
  • Contact
  • Privacy
  • Terms
  • Refunds
  • Delivery

© 2026 2daysbeforeinterview

  • Instagram(opens in a new tab)
  • YouTube(opens in a new tab)
  • X (Twitter)(opens in a new tab)
  • help@2daysbeforeinterview.com
HomeCompaniesProblems
Keep holding ⌥Alt and press a number · ? for every shortcut
Back
DSA
1 reportlast asked …
Uber

Most Pickups on One Straight Road

A ride-hailing team wants to plan a straight shuttle road through the city. Each pending pickup sits at an integer point [x, y] on the city map, and no two pickups share a point.

Given the list pickups, return the largest number of pickups that lie on one straight line. The line may point in any direction, including straight up and down.

Example 1

Input:  pickups = [[0,-1],[1,1],[2,3],[3,5],[4,2]]
Output: 4

[0,-1], [1,1], [2,3] and [3,5] each rise by 2 for every step of 1 to the right, so they share one line. [4,2] is off it.

Example 2

Input:  pickups = [[3,0],[1,4],[5,-4],[3,5],[-1,8],[3,-2]]
Output: 4

[-1,8], [1,4], [3,0] and [5,-4] fall by 4 for every step of 2 to the right. Seen from [3,0], [1,4] lies up-left and [5,-4] down-right, yet both are on the same line. The vertical line x = 3 holds only three pickups.

Example 3

Input:  pickups = [[7,-3]]
Output: 1

A single pickup is a line of one.

Constraints

  • 1 <= pickups.length <= 300
  • pickups[i].length == 2
  • -10^4 <= pickups[i][0], pickups[i][1] <= 10^4
  • All pickups are distinct.

Hints

0/3

Domains

Backend
asked Mar 2026Report
Discussion
Related questions
Asked atUber
My notes
Practice
EditorialLocked
Community solutions
Learning resources(3)
Uber
Uber