Problem Brief
Flight Path Package Drop
FULLTIMEOA
See Cisco online assessment and 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:
- Line 1: Integer
N, the number of x-coordinates - Line 2:
Nintegers representing the x-coordinates - Line 3: Integer
M, the number of y-coordinates - Line 4:
Mintegers representing the y-coordinates
Output:
The maximum number of drop points that can be covered in a single horizontal or vertical flight
1Example 1
Input
N = 5, xCoordinates = [1, 2, 3, 4, 5], M = 5, yCoordinates = [1, 2, 3, 4, 5]
Output
5
Explanation
:)