Solved LeetCode #560 with Prefix Sum and HashMap in Java

Day 80 of #100DaysOfLeetCode 💻✅ Solved #560. Subarray Sum Equals K problem in Java. Approach: • Used Prefix Sum with HashMap • Tracked cumulative sum while iterating • Checked if (sum - k) exists in map • Updated count based on previous occurrences Performance: ✓ Runtime: 23 ms (Beats 94.04% submissions) 🚀 ✓ Memory: 48.74 MB (Beats 63.25% submissions) Key Learning: ✓ Mastered Prefix Sum technique ✓ Learned efficient subarray counting using HashMap ✓ Improved understanding of cumulative sum patterns Learning one problem every single day 🚀 #Java #LeetCode #DSA #PrefixSum #HashMap #Arrays #ProblemSolving #CodingJourney #100DaysOfCode

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories