Java
Java copied to clipboard
Add Longest Substring with K Distinct Characters sliding window algor…
Summary
Added a hard sliding window algorithm: Longest Substring with K Distinct Characters.
Details
- Implemented sliding window + hashmap solution (O(n) time).
- Added JavaDoc and clean code following project guidelines.
- Added comprehensive JUnit tests to verify correctness and edge cases.
- Placed files in correct directory: com/thealgorithms/strings/
Why this is useful?
This is a commonly asked interview problem (Amazon, Google, Meta) and is not present in the repository. It demonstrates advanced sliding window patterns and educates beginners.