leetle

Daily challenge for 2025-08-06

218. Recipe Scaler

Write a function solve that scales recipe ingredients. Given ingredients as [amount, unit] pairs and a scaling factor, return scaled amounts rounded to 2 decimal places. Handle unit conversions: 1 cup = 16 tbsp, 1 tbsp = 3 tsp.

Example:
Input: [[2.0, "cup"], [1.5, "tsp"]], scale = 0.5
Output: [[1.0, "cup"], [0.75, "tsp"]]

Run this challenge interactively in Python or JavaScript when the app loads.