Problem · Hash Table

Find Maximum Number Drop Points Connected

Learn this problem
MediumCiscoINTERNOA
See Cisco hiring insights

Problem statement

Print an integer representing the number of coordinates in the best path which covers the maximum number of drop points by flying over the terrain once.

Note

A path is valid path if, more than one drop points are connected (Single coordinate don't create any path, so pilot cannot fly over it).

Constraints

1 < N, M ≤ 700 (where N is always equal to M).

Function

findMaximumNumberDropPointsConnected(x: int[], y: int[]) → int

Examples

Example 1

x = [2, 3, 2, 4, 2]y = [2, 2, 6, 5, 8]return = 3
There are 5 coordinates- (2,2), (3,2), (2,6), (4,5) and (2,8). The best path is the horizontal one covering (2,2), (2,6) and (2,8). So, the output is 3 :)

Constraints

1 < N, M ≤ 700 (where N is always equal to M).

More Cisco problems

drafts saved locally
public int findMaximumNumberDropPointsConnected(int[] x, int[] y) {
  // write your code here
}
x[2, 3, 2, 4, 2]
y[2, 2, 6, 5, 8]
expected3
checking account