leetle

Daily challenge for 2026-11-16

685. Token Replacement Score

You are given an array of integers tokens and an integer limit. In each step, you may either increase your score by 1 at the cost of the smallest token (if you have enough limit), or you may increase your limit by the value of the largest token at the cost of 1 score (if your score is at least 1). You can do these operations in any order. Each token can be used at most once. Return the maximum score you can achieve.

Example:
Input: {"tokens": [100], "limit": 50}
Output: 0

Assumptions:
- 0 <= tokens.length <= 100
- 1 <= tokens[i] <= 1000
- 0 <= limit <= 1000

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