- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program to find out the vertical area between two points where no point lies and is the widest in Python

Suppose, we are given n number of points as (x, y). A vertical area is an area that is extended infinitely along the y-axis. We have to find out the vertical area between two points such that no other point is inside the area and is the widest.

So, if the input is like pts = [[10,9],[11,11],[9,6],[11,9]], then the output will be 1.

The areas in red and blue are optimal and there are no points inside them.

To solve this, we will follow these steps −

sort the list pts

for i in range 1 to size of pts, do

return the maximum value of (pts[i, 0] - pts[i - 1, 0])

## Example

Let us see the following implementation to get better understanding

def solve(pts): pts.sort() return max(pts[i][0] - pts[i - 1][0] for i in range(1, len(pts))) print(solve([[10,9],[11,11],[9,6],[11,9]]))

## Input

[[10,9],[11,11],[9,6],[11,9]]

## Output

1

- Related Questions & Answers
- Program to find out is a point is reachable from the current position through given points in Python
- Program to find out the number of integral coordinates on a straight line between two points in Python
- Program to Find Out the Maximum Points From Removals in Python
- Python Program to find whether a no is the power of two
- Program to find out the length between two cities in shortcuts in Python
- Program to Find the Shortest Distance Between Two Points in C++
- Program to Find Out the Points Achievable in a Contest in Python
- Program to find out the maximum points collectable in a game in Python
- Program to find out the index in an array where the largest element is situated in Python
- Python Program to find whether a no is power of two
- Find the area between two curves plotted in Matplotlib
- Program to Find Out the Probability of Having n or Fewer Points in Python
- Program to find out the conversion rate of two currencies in Python
- Program to find out the similarity between a string and its suffixes in python
- Program to find out the sum of numbers where the correct permutation can occur in python

Advertisements