Summary of Longest Subarray with sum K | Brute - Better - Optimal | Generate Subarrays

Summary of "Longest Subarray with sum K | Brute - Better - Optimal | Generate Subarrays"


Main Ideas and Concepts


Detailed Methodology / Instructions

1. Brute Force (O(N³))

2. Better (O(N²))

3. Better Using Hashing (Prefix Sum + Hash Map)

Note

Notable Quotes

01:13 — « Just keep this in your mind when I say subarray it means contiguous, very very important word contiguous part of the array. »
38:03 — « The time complexity at worst case is big O of 2N. The right pointer runs till n, and the inner while loop runs overall for n iterations across the entire process, so total is about 2N. »
40:35 — « If you tell this entirely to the interviewer, he will be super duper impressed. »

Category

Educational

Video