# Weekly Contest 290

**The intersection of Multiple Arrays**

Given a 2D integer array `nums`

where `nums[i]`

is a non-empty array of **distinct** positive integers, return *the list of integers that are present in **each array** of* `nums`

* sorted in *** ascending order**.

**Example 1:**

**Input:** nums = [[**3**,1,2,**4**,5],[1,2,**3**,**4**],[**3**,**4**,5,6]]

**Output:** [3,4]

**Explanation:**

The only integers present in each of nums[0] = [**3**,1,2,**4**,5], nums[1] = [1,2,**3**,**4**], and nums[2] = [**3**,**4**,5,6] are 3 and 4, so we return [3,4].

**Example 2:**

**Input:** nums = [[1,2,3],[4,5,6]]

**Output:** []

**Explanation:**

There does not exist any integer present both in nums[0] and nums[1], so we return an empty list [].

**Constraints:**

`1 <= nums.length <= 1000`

`1 <= sum(nums[i].length) <= 1000`

`1 <= nums[i][j] <= 1000`

- All the values of
`nums[i]`

are**unique**.

# 2. Count Lattice Points Inside a Circle

Given a 2D integer array `circles`

where `circles[i] = [xi, yi, ri]`

represents the center `(xi, yi)`

and radius `ri`

of the `ith`

circle drawn on a grid, return *the **number of lattice points** that are present inside **at least one** circle*.

**Note:**

- A
**lattice point**is a point with integer coordinates. - Points that lie
**on the circumference of a circle**are also considered to be inside it.

**Example 1:**

**Example 2:**

**Input:** circles = [[2,2,2],[3,4,1]]

**Output:** 16

**Explanation:**

The figure above shows the given circles.

There are exactly 16 lattice points which are present inside at least one circle.

Some of them are (0, 2), (2, 0), (2, 4), (3, 2), and (4, 4).

**Constraints:**

`1 <= circles.length <= 200`

`circles[i].length == 3`

`1 <= xi, yi <= 100`

`1 <= ri <= min(xi, yi)`

# 3. Count the Number of Rectangles Containing Each Point

You are given a 2D integer array `rectangles`

where `rectangles[i] = [li, hi]`

indicates that `ith`

rectangle has a length of `li`

and a height of `hi`

. You are also given a 2D integer array `points`

where `points[j] = [xj, yj]`

is a point with coordinates `(xj, yj)`

.

The `ith`

rectangle has its **bottom-left corner** point at the coordinates `(0, 0)`

and its **top-right corner** point at `(li, hi)`

.

Return* an integer array *`count`

* of length *`points.length`

* where *`count[j]`

* is the number of rectangles that **contain** the *`jth`

* point.*

The `ith`

rectangle **contains** the `jth`

point if `0 <= xj <= li`

and `0 <= yj <= hi`

. Note that points that lie on the **edges** of a rectangle are also considered to be contained by that rectangle.

**Example 1:**

**Input:** rectangles = [[1,2],[2,3],[2,5]], points = [[2,1],[1,4]]

**Output:** [2,1]

**Explanation:**

The first rectangle contains no points.

The second rectangle contains only the point (2, 1).

The third rectangle contains the points (2, 1) and (1, 4).

The number of rectangles that contain the point (2, 1) is 2.

The number of rectangles that contain the point (1, 4) is 1.

Therefore, we return [2, 1].

**Example 2:**

**Input:** rectangles = [[1,1],[2,2],[3,3]], points = [[1,3],[1,1]]

**Output:** [1,3]

**Explanation:**

The first rectangle contains only the point (1, 1).

The second rectangle contains only the point (1, 1).

The third rectangle contains the points (1, 3) and (1, 1).

The number of rectangles that contain the point (1, 3) is 1.

The number of rectangles that contain the point (1, 1) is 3.

Therefore, we return [1, 3].

**Constraints:**

`1 <= rectangles.length, points.length <= 5 * 104`

`rectangles[i].length == points[j].length == 2`

`1 <= li, xj <= 109`

`1 <= hi, yj <= 100`

- All the
`rectangles`

are**unique**. - All the
`points`

are**unique**.

# 4. Number of Flowers in Full Bloom

You are given a **0-indexed** 2D integer array `flowers`

, where `flowers[i] = [starti, endi]`

means the `ith`

flower will be in **full bloom** from `starti`

to `endi`

(**inclusive**). You are also given a **0-indexed** integer array `persons`

of size `n`

, where `persons[i]`

is the time that the `ith`

person will arrive to see the flowers.

Return *an integer array *`answer`

* of size *`n`

*, where *`answer[i]`

* is the **number** of flowers that are in full bloom when the *`ith`

* person arrives.*

**Example 1:**

**Input:** flowers = [[1,6],[3,7],[9,12],[4,13]], persons = [2,3,7,11]

**Output:** [1,2,2,2]

**Explanation: **The figure above shows the times when the flowers are in full bloom and when the people arrive.

For each person, we return the number of flowers in full bloom during their arrival.

**Example 2:**

**Input:** flowers = [[1,10],[3,3]], persons = [3,3,2]

**Output:** [2,2,1]

**Explanation:** The figure above shows the times when the flowers are in full bloom and when the people arrive.

For each person, we return the number of flowers in full bloom during their arrival.

**Constraints:**

`1 <= flowers.length <= 5 * 104`

`flowers[i].length == 2`

`1 <= starti <= endi <= 109`

`1 <= persons.length <= 5 * 104`

`1 <= persons[i] <= 109`

Problems 3 and 4 are not submitted due to the time complexity so I will revise the problem again.

enjoy coding..