← 返回 cisco 的题目列表Maximum Drop Points in One Line
类型:qbank
Given x and y coordinate arrays for terrain drop points, choose one horizontal or vertical flight path that covers the maximum number of valid drop points.
Requirements
Input line 1 is xCoordinate_size, the number of x coordinates N.
Input line 2 contains N space-separated x coordinates.
Input line 3 is yCoordinate_size, the number of y coordinates M.
Input line 4 contains M space-separated y coordinates.
N is always equal to M, pairing the x and y arrays into points.
A flight path can be horizontal or vertical, but not diagonal and not a mix of both.
A valid path must connect more than one drop point; a single coordinate does not create a path.
Constraint shown: 1 < N, M <= 700.
Print the maximum number of drop points covered by one valid path.
Notes
Count frequencies of each x coordinate and each y coordinate; the answer is the larger maximum frequency, provided it is at least 2.
The screenshot does not show a full example, so treat edge cases such as all unique x and y coordinates carefully.