Largest Polygon
You are given a set of N points in the XY plane. There are many ways to make polygons (both concave and convex) in the XY plane connecting a subset of these points.
You have to select a subset from the given coordinates so that you can maximize the area of the polygon to find the largest polygon. Your task is to output the number of sides of this largest polygon.
Input Format
First line contains a single integer N, the number of coordinates
N lines follow, with i th of them having 2 integers, xi , yi , the x & y coordinates of the i th point
Output Format
A single integer, the number of sides in the largest polygon.
Constraints
- 4 \(\leq\) N \(\leq\) 103
- 1 \(\leq\) xi , yi \(\leq\) 106
- More than 25% of the test cases will have N \(\leq\) 100
Limits
- Time Limit: 1s
- Memory Limit: 256MB
Sample Input 0
5
2 2
0 2
1 1
0 0
2 0
Sample Output 0
4
Sample Input 1
10
0 2
1 2
2 1
0 1
1 1
2 2
3 1
0 0
1 0
2 0
Sample Output 1
5
Open on HackerRank ↗ · Markdown source · Back to the archive