Skip to content

Conversation

Anubhav-pandey004
Copy link
Contributor

Description

This PR adds an implementation of the Minimum Window Substring problem to the com.thealgorithms.slidingwindow package.
The algorithm finds the smallest substring in s that contains all characters of t.

Time Complexity: O(n) (where n = length of s)

Space Complexity: O(|charset|) (for HashMaps storing frequencies)

Code Summary

Implemented Solution.minWindow(String s, String t) method.

Uses two hash maps:

tFreq → stores required character frequencies of t.

windowFreq → tracks character frequencies in current window.

Expands right pointer until all required characters are included.

Shrinks from left to minimize window length while still valid.

Returns the smallest valid substring, or "" if none exists.

leetcode 76. Minimum Window Substring
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2025

Codecov Report

❌ Patch coverage is 0% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.06%. Comparing base (ef681e8) to head (6ab6e25).

Files with missing lines Patch % Lines
...gorithms/slidingwindow/MinimumWindowSubstring.java 0.00% 29 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6550      +/-   ##
============================================
- Coverage     75.18%   75.06%   -0.12%     
+ Complexity     5615     5614       -1     
============================================
  Files           690      691       +1     
  Lines         19408    19437      +29     
  Branches       3756     3762       +6     
============================================
- Hits          14592    14591       -1     
- Misses         4248     4277      +29     
- Partials        568      569       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DenizAltunkapan
Copy link
Member

DenizAltunkapan commented Sep 29, 2025

Please always add a test class to your corresponding implementatkon @Anubhav-pandey004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants