Problem · Greedy
Least Hours to Implement Features
Learn this problemProblem statement
There are two lists of size n - developmentTime and integrationTime. Any feature can be either implemented by development or by integration. While development of multiple features can happen concurrently by multiple developers, integration of features can only be sequential and can only be done by the team lead. Return the least number of hours to implement all the n features. Assume, there are more than n developers.
Function
leastHours(developmentTime: int[], integrationTime: int[]) → int
Complete the function leastHours in the editor.
leastHours has the following parameters:
- 1.
int[] developmentTime: an array of integers representing the time to develop each feature - 2.
int[] integrationTime: an array of integers representing the time to integrate each feature
Returns
int: the least number of hours to implement all features
Examples
Example 1
developmentTime = [3, 4, 5, 9]integrationTime = [3, 2, 5, 5]return = 5First 3 features are developed and take 5 hours and in the meanwhile, integration of the last one takes place.
Example 2
developmentTime = [8, 10, 6, 7]integrationTime = [1, 2, 2, 1]return = 6Sum of all integrations (1 + 2 + 2 + 1 = 6) is less than the minimum development time, so all features are integrated.
More Salesforce problems
- Minimize Total Input Cost (for LTMS)Seen Jun 2026
- Count Prime StringsONSITE INTERVIEW · Seen Jun 2026
- Final Pod Counts After LogsOA · Seen May 2026
- ATM Queue Exit OrderPHONE SCREEN · Seen May 2026
- Good Ways to Split an ArrayPHONE SCREEN · Seen May 2026
- Generate Seen Binary StringsOA · Seen May 2026
- Update Pod Counts From LogsOA · Seen May 2026
- Minimum Removals to Balance ArrayOA · Seen May 2026