Scale Ingredient Quantities
Updated
Problem statement
Each string in ingredients begins with an integer quantity followed by its unit and ingredient name. Multiply every quantity by people and preserve the rest of each string.
Function
scaleIngredients(ingredients: String[], people: int) → String[]Examples
Example 1
ingredients = ["100 g flour","50 g water","10 g sugar"]people = 8return = ["800 g flour","400 g water","80 g sugar"]Each leading quantity is multiplied by 8.
More Upstart Online Assessment questions
- Buffet Day GainsOA · Seen Sep 2026
- Case-Insensitive Anagram CheckOA · Seen Sep 2026
- Filter Duplicates While Preserving OrderOA · Seen Sep 2026
- ABO Parent Genotype CombinationsOA · Seen Aug 2026
- Chunked Byte Stream ChecksumsOA · Seen Aug 2026
- Cluster Size on DiskOA · Seen Aug 2026
- Double Substitution DecryptionOA · Seen Aug 2026
- Add Drama to Text GroupsOA · Seen Jul 2026
- Lexicographic Word FrequenciesOA · Seen Jul 2026
- Minimum Absolute Pair DifferenceOA · Seen Jul 2026
Similar questions at other companies
- IPv4 Address ClassificationRippling · OARippling interview questions
- Generate Table of ContentsJP Morgan Chase · OAJP Morgan Chase interview questions
- Incident MonitorStripe · OAStripe interview questions
- Correct Apartment Bedroom CountsRamp · OARamp interview questions
- Hidden ArtifactsIMC Trading · OAIMC Trading interview questions
- Build a Profile Sentence from CSVAirbnb · OAAirbnb interview questions
- Restricted Decimal Number ValidatorLinkedIn · PHONE SCREENLinkedIn interview questions
- Extensible Grep Line FilterBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Format CSV Rows as an ASCII TableAmazon · PHONE SCREEN
- Compare Calendar DatesWells Fargo · PHONE SCREENWells Fargo interview questions