Which optimized hashing pattern solves this lesson cleanly?

Practice this question from Subarray Sum Equals K - Prefix Sum Hashmap Pattern Practice Quiz, with options and an explanation.

Question

Which optimized hashing pattern solves this lesson cleanly?

Option A — Correct answer

Prefix sum hashmap using currentSum - k.

Option B

Plain nested loops without stored state

Option C

Two pointers after sorting every time

Option D

Stack matching only

Explanation

Prefix sum hashmap using currentSum - k.

Subarray Sum Equals K - Prefix Sum Hashmap Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker