This is a verified interview question from Uidai. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Garden Bloom Scheduling" covers key patterns like Other.
"You are tasked with managing a garden where you need to plant and grow N different flower seeds to achieve full bloom. Each seed requires a specific number of days to plant and then additional days to grow before blooming. You can only work on planting one seed per day, but once a seed is fully planted, it grows automatically without requiring your attention. Your goal is to determine the optimal planting order to minimize the total time until all flowers have bloomed. The key challenge is to strategically order the seeds such that while some are growing, you can continue planting others, thereby overlapping growth and planting periods efficiently to achieve the earliest possible bloom day for all flowers. ### Function Description: You need to implement the function `earliestFullBloom`. This function should determine the minimum number of days required for all seeds to be fully bloomed by optimally ordering the planting sequence. ### Function Parameters: - `N`: An integer representing the number of seeds. - `plantTime`: An array/vector of N integers where `plantTime[i]` represents the number of consecutive days required to plant the i-th seed. - `growTime`: An array/vector of N integers where `growTime[i]` represents the number of days the i-th seed takes to grow after being completely planted. ### Return: An integer representing the earliest day on which all seeds will be blooming. ### Input Format: - The first line contains an integer N, representing the number of seeds. - The second line contains N space-separated integers representing the plantTime array. - The third line contains N space-separated integers representing the growTime array. ### Output Format: A single integer — the earliest day number when all flowers are blooming."
Join thousands of developers practicing for Uidai.