Maximum Coin Tower Height
Updated
Problem statement
Coin i is coins[i]=[width,diameter]. Build a tower using each chosen coin at most once. Every coin above another must have both strictly smaller width and strictly smaller diameter.
The tower height is the sum of the widths of its coins. Return the greatest possible height, rather than the number of coins. Coins cannot be rotated. An empty collection has height 0.
Function
maximumTowerHeight(coins: int[][]) → intExamples
Example 1
coins = [[4,4],[3,3],[2,2]]return = 9All three coins fit, with total width 4+3+2=9.
Example 2
coins = [[5,2],[4,3],[3,1]]return = 8A bottom coin [5,2] supports [3,1], giving height 8. Coin [4,3] cannot sit above [5,2] because its diameter is larger.
Constraints
0 <= coins.length <= 200.- Each coin row has exactly 2 entries.
1 <= every width and diameter <= 10000.
More Expedia Online Assessment questions
- Balanced NumbersOA · Seen Aug 2026
- REST API: Discounted PriceOA · Seen Aug 2026
- Maximum Team SizeOA · Seen Mar 2026
- Per-Domain Request LimiterOA · Seen Oct 2025
- Count Equal-Frequency SubsequencesOA · Seen Mar 2025
- Count Increasing Stock PeriodsOA · Seen Mar 2025
- Get Minimum StepsOA · Seen Oct 2024
- Rank Songs by PopularityOA · Seen Oct 2024
- Calculate the SumOA · Seen Oct 2024
- Get Maximum EfficiencyOA · Seen Oct 2024
Similar questions at other companies
- Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
- Longest String ChainVisa · OAVisa interview questions
- Minimum Edit-Distance String for Each QueryTarget · OA
- Maximum Taxi EarningsWells Fargo · OAWells Fargo interview questions
- Max Sum of Non-Overlapping IntervalsAmazon · OA
- Maximize Power Values Sum 🪴Google · OAGoogle interview questions
- Platform Referral RewardsScale AI · OAScale AI interview questions
- Shipping Starts and Terminal DestinationsIntuit · OAIntuit interview questions
- Weighted Jobs from an Encoded Test CaseJP Morgan Chase · OAJP Morgan Chase interview questions
- Find Longest ChainBloomberg LP · OABloomberg LP interview questions
Interview reports that mention this question
Expedia interview experiences
- Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
- Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
- Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
- Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
- Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)