swativ15 3835c4822a 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>
2026-02-05 22:07:11 +00:00
2024-09-22 01:54:47 +05:30
2024-01-08 23:48:11 +02:00
2021-02-25 16:15:52 -06:00
2024-04-08 18:08:35 +00:00

The Algorithms - Java

Build codecov Discord chat Gitpod ready-to-code

You can run and edit the algorithms, or contribute to them using Gitpod.io (a free online development environment) with a single click.

Open in Gitpod

All algorithms are implemented in Java (for educational purposes)

These implementations are intended for learning purposes. As such, they may be less efficient than the Java standard library.

Contribution Guidelines

Please read our Contribution Guidelines before you contribute to this project.

Algorithms

Our directory has the full list of applications.

Languages
Java 100%