Problem · Hash Table

Flight Path Package Drop

EasyCiscoFULLTIMEOA
See Cisco hiring insights

A pilot needs to fly over a 2D terrain exactly once and cover as many drop points as possible. Each drop point is represented by a 2D coordinate. The flight path can only be horizontal or vertical. Write an algorithm to determine the maximum number of drop points that can be covered in a single flight.

Input:

  1. Line 1: Integer N, the number of x-coordinates
  2. Line 2: N integers representing the x-coordinates
  3. Line 3: Integer M, the number of y-coordinates
  4. Line 4: M integers representing the y-coordinates

Output:

The maximum number of drop points that can be covered in a single horizontal or vertical flight

Examples
01 · Example 1
N = 5
xCoordinates = [1, 2, 3, 4, 5]
M = 5
yCoordinates = [1, 2, 3, 4, 5]
return = 5
:)
More Cisco problems
drafts saved locally
public int maxDropPointsCovered(int[] xCoordinates, int[] yCoordinates) {
  // write your code here
}
N5
xCoordinates[1, 2, 3, 4, 5]
M5
yCoordinates[1, 2, 3, 4, 5]
expected5
sign in to submit