HardPro challengeJavaScriptTypeScript

Signals — Fine-Grained Reactivity

ReactReactivityPatterns

Implement signal(initial) returning [get, set], and effect(fn)
that auto-tracks signal reads and re-runs when they change.

solve(ops) drives signals. Returns the log of effect call values.

Sample tests

Test #1Same value still triggers
Input: [[1,1,1]]
Output: [0,1,1,1]
Test #2Four updates
Input: [[10,20,30,40]]
Output: [0,10,20,30,40]
Test #3No updates
Input: [[]]
Output: [0]
Test #4Effect runs once + 3 updates
Input: [[1,2,3]]
Output: [0,1,2,3]
Test #5Single update
Input: [[5]]
Output: [0,5]