## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Largest Square in the garden CodeChef Solution 2022

Chef has a garden of size $N×N$. The garden is divided into ${N}^{2}$ squares of size $1×1$ each.

Chef has plants in some unit squares of the garden, because of which, that part looks green.
Formally, for the ${i}^{th}$ row $\left(0\le i, Chef has plants in all the columns from ${A}_{i}$ to ${B}_{i}$ (both inclusive) where $0\le {A}_{i}\le {B}_{i}.

Help Chef find the length of the side of the largest square that is green.

### Input Format

• The first line contains an integer $N$, the size of the garden.
Solution Click Below:-  👉
👇👇👇👇👇

• The next $N$ lines contain two space-separated integers ${A}_{i}$ and ${B}_{i}$, representing that plants are present in all the columns from ${A}_{i}$ to ${B}_{i}$ (both inclusive) of the ${i}^{th}$ row.

### Output Format

Output a single integer denoting the length of the side of the largest square that is green. In other

Bidding CodeChef Solution

Pass the Exam CodeChef Solution

Chef and Candies CodeChef Solution

Journey of the Knight CodeChef Solution

Slow Solution CodeChef Solution

Game of Piles Version 1 CodeChef Solution

Find A, B, C CodeChef Solution

Largest Square in the garden CodeChef Solution

Game of Piles Version 2 CodeChef Solution

words, output the length of the side of the square with maximum size, inside which all unit squares have plants.

### Constraints

• $1\le N\le {10}^{6}$