Opening your workspace…
Workspace/Coding room
Opening your workspace…
The brewery's ledger records signed token adjustments in order: positive entries add tokens, negative entries refund them, and zero entries leave the balance unchanged. An audit strip is any nonempty contiguous section of the ledger. Count how many audit strips have a total exactly equal to target. Strips with different start or end positions count separately, even when their values are identical. Return the count, not the strips.
[3,-1,-2,3], 3OUTPUT3The strips at inclusive index ranges [0, 0], [0, 3], and [3, 3] each total 3.
[0,0,0], 0OUTPUT6All three length-1 strips, both length-2 strips, and the full length-3 strip total zero.
Tab inserts two spaces. Press Escape, then Tab, to leave the editor. Press Control or Command and Enter to submit.
[3,-1,-2,3], 33Public samples only. These checks do not award ranked points.
Walk through a solution, check its time and space costs, and compare it with yours.
Checking your progress…