FastPrepFastPrep
Problem Brief

Get Minimum Number of Routes

OA

The first line of the input consists of two space-separated integers - num and numCord, representing the number of pickup locations (N) and number of coordinates for a pick up location (numCord (P) is always equal to two), respectively. The next N lines consist of P space-separated integers - pickX and pickY, representing the X and Y coordinates of a pickup location, respectively. The next line consists of an integer - baseXₒ representing the X coordinate of the base location. The next line consists of an integer - baseYₒ representing the Y coordinate of the base location.

Print an integer representing the minimum number of routes connecting all the pickup locations to the base location.

❤️‍🔥 Thanks a bazillion, spike! ❤️‍🔥

1Example 1

Input
pickupLocations = [[1, 1], [-1, 1], [2, 3]], baseX = 0, baseY = 0
Output
3
Explanation

From the base coordinate (0,0) three different routes will cover all the pickup locations.

Constraints

Limits and guarantees your solution can rely on.

  • 1 ≤ num ≤ 10^5
  • -10^3 ≤ pickX, pickY, baseXₒ, baseYₒ ≤ 10³
public int getMinimumNumberOfRoutes(int[][] pickupLocations, int baseX, int baseY) {
  // write your code here
}
Input

pickupLocations

[[1, 1], [-1, 1], [2, 3]]

baseX

0

baseY

0

Output

3

Sign in to submit your solution.