Chemical Reaction Prefix Maxima
Updated
Problem statement
times[i] is the nonnegative reaction time of chemical i. The zero-based indices in order describe chemicals added to a mixture. After each addition, return the largest reaction time among all chemicals selected so far. Repeated indices are allowed and do not remove earlier selections. An empty order returns an empty array.
Function
reactionMaxima(times: int[], order: int[]) → int[]Examples
Example 1
times = [3,8,2]order = [2,0,1]return = [2,3,8]The maximum grows as times 2, 3, and 8 are added.
Example 2
times = [5]order = [0,0]return = [5,5]Choosing the same chemical again leaves the maximum unchanged.
Constraints
- For this exercise, assume 1 <= times.length <= 200000, order.length <= 200000, and times[i] <= 10^9.
- Every order index is valid.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Missing IntervalsIBM · OAIBM interview questions
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Count Valid Square PairsAuxoAI · OA
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Two SumAmazon · OA · PHONE SCREEN
- Find Words That Can Be Formed by CharactersTabaPay · OA
- Server InvestmentRippling · OARippling interview questions
- Book Reading EveningsGoogle · OAGoogle interview questions
- Minimum Index Distance Between Person and CakeSnowflake · OA · PHONE SCREENSnowflake interview questions