3 ms·
Correct. In the real-life example this came from, a separate parameter would control how to reset the lesson counter but it was moved into a boolean property to
by josevalim 6y ago
Correct. In the real-life example this came from, a separate parameter would control how to reset the lesson counter but it was moved into a boolean property to keep the problem focused.
Your "category" idea would be a nice addition to the problem though. The logic of when to reset would still be fairly simple and folks would have to explore how to represent the initial category value before traversal starts. I assume most would solve it with nil and maybe/option types.