Problem · String
Scale Ingredient Quantities
Learn this problemProblem 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 problems
- Coordinate Bounding BoxOA · Seen Jul 2026
- Increase Exclamations and Convert PeriodsOA · Seen Jul 2026
- Interleave Equal-Length Strings by ColumnOA · Seen Jul 2026
- Bounding Box from CoordinatesOA · Seen May 2026
- Filter by Threshold and Return Name with Max ScoreOA · Seen May 2026
- Filter Odds and Reverse EvensOA · Seen May 2026
- Find the Wrong Digit Index in a SumOA · Seen May 2026