Subarray Sum Equals K | Arrays & Hashing | Animated DSA Explanation in Java
AlgoRung
0:00 / 0:00
Subarray Sum Equals K | Arrays & Hashing | Animated DSA Explanation in Java
2 просмотра · 13 дн. назад
AlgoRung
9 подписчиков
2 просмотра · 13 дн. назад
Subarray Sum Equals K (Medium) explained step by step with animations: the idea, a brute force, the optimal solution and its complexity, with Java code.
Given an integer array nums (it may contain negatives) and an integer k, return the number of contiguous subarrays whose sum equals k.
Java code + notes: https://algorung.com/dsa/arrays/subar...
Practise it with spaced revision: https://algorung.com/app/problems/sub...
Chapters
0:00 The problem
0:54 Extend every start
1:45 Prefix sums
2:47 Element by element
4:52 Complexity
5:09 Edge cases & recap
Similar problems
• Subarray with given XOR: https://algorung.com/dsa/arrays/subar...
• Range Sum Query - Immutable: https://algorung.com/dsa/arrays/range...
• Two Sum: • Видео
• 3Sum: https://algorung.com/dsa/arrays/3sum
More Arrays & Hashing problems: https://algorung.com/dsa/arrays
All patterns: https://algorung.com/patterns
#DSA #ArraysHashing #SubarraySumEqualsK #Java #CodingInterview #LeetCode #AlgoRung