Code Room
CodingMediumcod-g1482
Subject Dynamic programming 1dLevel Entry–Mid~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A budgeting app stores one account-balance snapshot per month. The product team wants a 'growth score': the largest number of snapshots you can pick — keeping their original order but skipping any months you like — so that every picked balance is strictly higher than the one picked before it. Given the snapshots (at most 1000), return that count. An empty list returns 0. For example, [10, 9, 2, 5, 3, 7, 101, 18] gives 4 via 2, 5, 7, 101.

Implement
longest_growth_run(balances: list[int]) → int
Examples
in[[10,9,2,5,3,7,101,18]]out4
in[[3,3,3]]out1
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.