Java icon indicating copy to clipboard operation
Java copied to clipboard

Add Longest Substring with K Distinct Characters sliding window algor…

Open Subhamstar opened this issue 2 weeks ago • 0 comments

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.

Subhamstar avatar Nov 23 '25 17:11 Subhamstar