Python Code for Polygon TCS Codevita

Coding Question 4

In this article, we will discuss about the TCS CodeVita Coding Question which is asked in the TCS placement test along with a detailed solution. This will help you excel your coding problems.

TCS Coding Question 2 Day1 slot1

Polygon Coding Question 

Problem Description:

You are given N number of coordinates and you have to create a polygon from these points such that they will make a polygon with maximum area.

Note: coordinates provided in the input may or may not be in sequential form.

Constraints
1 <= N <= 10

Input:

First line contains an integer N which depicts number of co-ordinates

Next N lines consist of two space separated integer depicting coordinates of in form of xy

Output:
Print the maximum possible area possible by creating a polygon by joining the coordinates. 

If the area is in decimal form, print the absolute value as output.

Time Limit (secs):
1

Examples:
Input:

4

0  0

2  0

0  2

2  2

Output:

4

Explanation:

As we can imagine that these points will make a square shape and the maximum possible area made by the polygon will be 4.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription