Skip to content

Conversation

@ruturajjadhav07
Copy link
Contributor

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

Subarray Sum Equals K

This PR adds a new algorithm to the prefixsum package:

  • SubarraySumEqualsK.java — Counts the number of continuous subarrays that sum to a target value k using prefix sum + HashMap technique in O(N) time.
  • SubarraySumEqualsKTest.java — JUnit 5 tests covering positive numbers, negative numbers, zeros, empty arrays, and null input.

References:

@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.38%. Comparing base (dfaa495) to head (964175f).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7252      +/-   ##
============================================
+ Coverage     79.36%   79.38%   +0.01%     
- Complexity     7012     7017       +5     
============================================
  Files           784      785       +1     
  Lines         22970    22982      +12     
  Branches       4519     4520       +1     
============================================
+ Hits          18231    18244      +13     
  Misses         4017     4017              
+ Partials        722      721       -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 DenizAltunkapan merged commit 3e36833 into TheAlgorithms:master Feb 1, 2026
7 checks passed
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