Minimum Image Processing Cost
Updated
Problem statement
You must process n images. Image i requires a filter on every day from startDay[i] through endDay[i], inclusive, and filtering that image costs filterCost[i] per day.
An exclusive offer allows you to apply a filter to all n images for discountPrice on a day. Determine the minimum total cost of processing all images, and return that cost modulo 10^9 + 7.
Function
getMinProcessingCost(filterCost: int[], startDay: int[], endDay: int[], discountPrice: int) → intExamples
Example 1
filterCost = [2,3,4]startDay = [1,1,2]endDay = [2,3,4]discountPrice = 6return = 21For filterCost = [2, 3, 4], startDay = [1, 1, 2], endDay = [2, 3, 4], and discountPrice = 6, the individual filtering costs by day are:
| Day | Images | Total cost |
|---|---|---|
1 | [1, 2] | 2 + 3 = 5 |
2 | [1, 2, 3] | 2 + 3 + 4 = 9 |
3 | [2, 3] | 3 + 4 = 7 |
4 | [3] | 4 |
Using the all-images offer for 6 on days 2 and 3 is optimal. The final cost is 5 + 6 + 6 + 4 = 21, so its value modulo 10^9 + 7 is 21.
More Citadel Online Assessment questions
- Speed Up a Slow FunctionOA · PHONE SCREEN · Seen Nov 2026
- Possible MEX Values After One Optional IncrementOA · Seen Oct 2026
- Busy IntersectionOA · Seen Sep 2026
- Shortest Path in an Unweighted GraphOA · Seen Sep 2026
- Maximize Workday EarningsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Minimum Changes for Palindromic BlocksOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Coprime Pick with Change CostOA · Seen Jul 2026
- Process SchedulingOA · Seen Mar 2026
- Employee With the Most OverlapsOA · Seen Feb 2026
- Most Employees Working at OnceOA · Seen Feb 2026
Similar questions at other companies
- Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
- Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions
- Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
- Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
- Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
- Maximum Compatible Time WindowsIBM · OAIBM interview questions
- Merge Overlapping IntervalsGoldman Sachs · OAGoldman Sachs interview questions
- Track Received Byte RangesRoblox · OARoblox interview questions
- Merge IntervalsBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Free Windows Between Busy IntervalsScale AI · OA · PHONE SCREENScale AI interview questions
Citadel interview experiences
- Citadel Securities Quant Researcher Intern Loop: 1 Experience
- Citadel Securities Research Engineer Interview: 1 Experience
- Citadel Securities SWE Intern First Round: 2 Experiences
- Citadel Securities Experienced SWE Interviews: 1 Experience
- Citadel SWE Intern Later Rounds and Superday: 13 Experiences
- Citadel SWE Intern First-Round Questions: 20 Experiences