Intermediate
Keep the newest message
Messages for one station arrive out of order. Each has a seq number. apply(state, message) must keep the message with the highest seq and ignore older or repeated ones.
The page prints the final bike count for each station. Station A should end on 12 and station B on 7.
What Check tests
- Station A ends on 12
- Station B ends on 7
- The late and repeated messages are reported
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.