Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-268

Scratchpad Token Growth

Problem

Track scratchpad token growth over reasoning steps. Start at initial_tokens and apply each increment in increments in order, clamping the running total at 0 after each step.

Return the running totals after every step, and an empty list when increments is empty.

Hint

Clamp after each increment, then append the current total.

Test cases

case 1
in: [10,[5,-3,7]]
expected: [15,12,19]
case 2
in: [0,[]]
expected: []
case 3
in: [5,[0]]
expected: [5]
case 4
in: [100,[-200,50]]
expected: [0,50]
case 5
in: [0,[1,2,3]]
expected: [1,3,6]
Starter codePython
def scratchpad_token_growth(initial_tokens, increments):
    # Your code here
    pass

5 test cases · run your code against them in the editor