Refactor: simplify validation and improve backtracking cleanup (#7258)
### Summary This PR makes small readability and maintainability improvements to the algorithm implementation. ### Changes - Removed a redundant `n < 0` validation check since the method contract already ensures valid `n` - Replaced `current.remove(current.size() - 1)` with `current.removeLast()` to better express backtracking intent ### Rationale - Simplifies input validation without changing behavior - Uses the `Deque` API to make the backtracking step clearer and less error-prone ### Impact - No change in algorithm logic or time/space complexity - Output remains identical Co-authored-by: Swati Vusurumarthi <swativs869@gmail.com>
S
swativ15 committed
3835c4822a651f90be03830f778bbc41c898c64c
Parent: 249b88f
Committed by GitHub <noreply@github.com>
on 2/5/2026, 10:07:11 PM