Problem · Geometry

Get Minimum Number of Routes

MediumOA

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! ❤️‍🔥

Examples
01 · Example 1
pickupLocations = [[1, 1], [-1, 1], [2, 3]]
baseX = 0
baseY = 0
return = 3

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

Constraints
  • 1 ≤ num ≤ 10^5
  • -10^3 ≤ pickX, pickY, baseXₒ, baseYₒ ≤ 10³
drafts saved locally
public int getMinimumNumberOfRoutes(int[][] pickupLocations, int baseX, int baseY) {
  // write your code here
}
pickupLocations[[1, 1], [-1, 1], [2, 3]]
baseX0
baseY0
expected3
checking account