Count Inclusive Bloom Intervals at Each Visitor Time
Quick Overview
Count the flowers blooming at each arrival time, with both interval endpoints included. Preserve the order of arrivals and handle repeated times independently.
Count Inclusive Bloom Intervals at Each Visitor Time
Company: Roblox
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Other
### Problem
Each flower in `flowers` blooms throughout its inclusive interval `[start, end]`. For each arrival time in `people`, count how many flowers are blooming at that time. Return the counts in the same order as the arrival times.
```cpp
class Solution {
public:
vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& people);
};
```
### Examples
**Example 1:**
```text
Input: flowers = [[2,4],[4,7]], people = [7,1,4,4]
Output: [1,0,2,2]
Explanation: Both intervals contain time 4. Only the second contains time 7, and neither contains time 1.
```
**Example 2:**
```text
Input: flowers = [[5,5]], people = [4,5,6]
Output: [0,1,0]
Explanation: The interval contains only time 5, including both identical endpoints.
```
### Constraints
- `1 <= flowers.length, people.length <= 50000`.
- Every flower has two integers with `1 <= start <= end <= 10^9`.
- `1 <= people[i] <= 10^9`.
### Clarifying Questions
- Does a flower bloom at both endpoints of its interval? Yes.
- Can two people arrive at the same time? Yes; each person still needs an output entry.
- Is a flower with `start == end` valid? Yes; it blooms at that single time.
```hint Check the boundary
Check an arrival equal to an interval's start or end, and one immediately outside it.
```
Overview: Count the flowers blooming at each arrival time, with both interval endpoints included. Preserve the order of arrivals and handle repeated times independently.
Count Inclusive Bloom Intervals at Each Visitor Time
Roblox
Source window: 0–3 months · as of Oct 21, 2026
hardSoftware EngineerOtherCoding & Algorithms
0
0
Problem
Each flower in flowers blooms throughout its inclusive interval [start, end]. For each arrival time in people, count how many flowers are blooming at that time. Return the counts in the same order as the arrival times.
class Solution {
public:
vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& people);
};
Examples
Example 1:
Input: flowers = [[2,4],[4,7]], people = [7,1,4,4]
Output: [1,0,2,2]
Explanation: Both intervals contain time 4. Only the second contains time 7, and neither contains time 1.
Example 2:
Input: flowers = [[5,5]], people = [4,5,6]
Output: [0,1,0]
Explanation: The interval contains only time 5, including both identical endpoints.
Constraints
1 <= flowers.length, people.length <= 50000
.
Every flower has two integers with
1 <= start <= end <= 10^9
.
1 <= people[i] <= 10^9
.
Clarifying Questions Guidance
Does a flower bloom at both endpoints of its interval? Yes.
Can two people arrive at the same time? Yes; each person still needs an output entry.
Is a flower with
start == end
valid? Yes; it blooms at that single time.