java.lang.Object
g2201_2300.s2251_number_of_flowers_in_full_bloom.Solution

public class Solution extends Object
2251 - Number of Flowers in Full Bloom.<p>Hard</p> <p>You are given a <strong>0-indexed</strong> 2D integer array <code>flowers</code>, where <code>flowers[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> means the <code>i<sup>th</sup></code> flower will be in <strong>full bloom</strong> from <code>start<sub>i</sub></code> to <code>end<sub>i</sub></code> ( <strong>inclusive</strong> ). You are also given a <strong>0-indexed</strong> integer array <code>persons</code> of size <code>n</code>, where <code>persons[i]</code> is the time that the <code>i<sup>th</sup></code> person will arrive to see the flowers.</p> <p>Return <em>an integer array</em> <code>answer</code> <em>of size</em> <code>n</code><em>, where</em> <code>answer[i]</code> <em>is the <strong>number</strong> of flowers that are in full bloom when the</em> <code>i<sup>th</sup></code> <em>person arrives.</em></p> <p><strong>Example 1:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2022/03/02/ex1new.jpg" alt="" /></p> <p><strong>Input:</strong> flowers = [[1,6],[3,7],[9,12],[4,13]], persons = [2,3,7,11]</p> <p><strong>Output:</strong> [1,2,2,2]</p> <p><strong>Explanation:</strong> 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.</p> <p><strong>Example 2:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2022/03/02/ex2new.jpg" alt="" /></p> <p><strong>Input:</strong> flowers = [[1,10],[3,3]], persons = [3,3,2]</p> <p><strong>Output:</strong> [2,2,1]</p> <p><strong>Explanation:</strong> 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.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= flowers.length <= 5 * 10<sup>4</sup></code></li> <li><code>flowers[i].length == 2</code></li> <li><code>1 <= start<sub>i</sub> <= end<sub>i</sub> <= 10<sup>9</sup></code></li> <li><code>1 <= persons.length <= 5 * 10<sup>4</sup></code></li> <li><code>1 <= persons[i] <= 10<sup>9</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • fullBloomFlowers

      public int[] fullBloomFlowers(int[][] flowers, int[] persons)