Description
Solutions
Find Maximum Number Drop Points Connected
🤘 INTERN

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).

Example 1:

Input:  x = [2, 3, 2, 4, 2], y = [2, 2, 6, 5, 8]
Output: 3
Explanation:
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).
Thumbnail 0
Testcase

Result
Case 1

input:

output: