Maximum Weighted End-Pick Score
Updated
Problem statement
Choose exactly multipliers.length numbers from nums. At step t, remove either the first or the last remaining number, multiply it by multipliers[t], and add the product to your score.
The multiplier order is fixed. Every multiplier must be used, even if doing so decreases the score. Return the largest possible total score.
When all multipliers equal one, this is the base task of choosing k endpoint numbers to maximize their sum. The weighted task preserves that case and the interview follow-up in one contract.
Function
maximumEndPickScore(nums: int[], multipliers: int[]) → intExamples
Example 1
nums = [1,2,3]multipliers = [3,2,1]return = 14Choose 3, then 2, then 1: 3*3 + 2*2 + 1*1 = 14.
Example 2
nums = [9,1,2,8]multipliers = [1,1]return = 17The base case chooses 9 and 8 for total 17.
Constraints
1 <= multipliers.length <= min(nums.length, 400).1 <= nums.length <= 20000.-1000 <= nums[i], multipliers[t] <= 1000.
More Rippling Onsite Interview questions
- Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Delivery Cost TrackerPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Maximum Currency Conversion Along a Simple PathPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Top K Frequent WordsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
- Future-Effective Employee SalaryONSITE INTERVIEW · Seen Aug 2026
- Filter and Sort Scheduled TasksONSITE INTERVIEW · Seen Jul 2026
Similar questions at other companies
- Optimal Account BalancingAmazon · ONSITE INTERVIEW
- Russian Doll EnvelopesGoogle · ONSITE INTERVIEWGoogle interview questions
- Global Charger AssignmentSpotify · ONSITE INTERVIEW
- Minimum Taps to Water a GardenThe D.E. Shaw Group · ONSITE INTERVIEWThe D.E. Shaw Group interview questions
- Longest Increasing Path in a MatrixNew Relic · PHONE SCREEN · ONSITE INTERVIEW
- Longest Increasing Path in a MatrixVisa · ONSITE INTERVIEWVisa interview questions
- Trapping Rain WaterMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Russian Doll EnvelopesInMobi · ONSITE INTERVIEWInMobi interview questions
- Russian Doll EnvelopesAirbnb · ONSITE INTERVIEWAirbnb interview questions