All challenges
Design a Counter class
Classes
solution.ts
easy+40 XP
Implement a `Counter` class with `inc()`, `dec()`, and `value()` methods. Start at 0. `dec()` must not go below 0.
Hints
- Keep a private n field.
- In dec(), only subtract if n > 0.
Judge
Press Run tests to execute your solution in the sandbox judge.