ARRAYS | Full DSA Guide + 5 LeetCode Problems in Python
Big O Zoo
0:00 / 0:00
ARRAYS | Full DSA Guide + 5 LeetCode Problems in Python
13 просмотров · 11 дн. назад
Big O Zoo
11 подписчиков
13 просмотров · 11 дн. назад
Elephants never forget, and neither does memory. 🐘 In this Big O Zoo episode, Ellie the Elephant takes you inside your computer's memory to show what an array really is, why arr[i] is instant but insert(0, x) is slow, how Python lists secretly resize themselves (amortized O(1)!), and then we solve 5 of the most-asked array interview questions at big tech companies, step by step, in Python.
🧠 What you'll learn
What an array is: contiguous memory, same-size slots, addresses
Why indexing is O(1) (the address formula) and why we count from 0
Search, insert, delete: what's O(1), what's O(n), and why
Dynamic arrays & amortized O(1) append (how Python lists grow)
Python list cheat sheet (slicing, pop(0), "in", sort…)
2D arrays, row-major order, and the [[0]*3]*3 trap
5 interview patterns that unlock hundreds of problems
🧩 Problems solved (Python)
1️⃣ Two Sum (LeetCode 1): Hash map
2️⃣ Best Time to Buy and Sell Stock (LeetCode 121): Running minimum
3️⃣ Container With Most Water (LeetCode 11): Two pointers
4️⃣ Maximum Subarray (LeetCode 53): Kadane's algorithm
5️⃣ Product of Array Except Self (LeetCode 238): Prefix & suffix
📝 Homework
Contains Duplicate (217) • Two Sum II (167) • Subarray Sum Equals K (560) • Trapping Rain Water (42)
⏱️ Chapters
0:00 Intro
0:29 Welcome to the Zoo
1:12 What is an array?
2:35 Indexing & O(1) access
4:13 Searching: O(n)
5:11 Inserting: O(1) vs O(n)
6:28 Deleting
7:04 Array scorecard
7:30 Dynamic arrays & amortized O(1)
9:44 Python list cheat sheet
10:34 2D arrays (+ a Python trap)
11:48 The 5 interview patterns
12:39 Problem 1: Two Sum (hash map)
15:05 Two Sum: walkthrough
15:54 Two Sum: code & complexity
17:13 Problem 2: Best Time to Buy & Sell Stock
18:50 Stock: walkthrough
19:35 Stock: code & complexity
20:28 Problem 3: Container With Most Water
22:16 Water: walkthrough
23:11 Water: code & complexity
23:53 Problem 4: Maximum Subarray (Kadane)
25:23 Kadane: walkthrough
26:22 Kadane: code & complexity
27:10 Problem 5: Product of Array Except Self
28:53 Product: walkthrough
29:57 Product: code & complexity
30:48 Recap: patterns & clues
31:35 Pop quiz
32:21 Homework & outro
🐾 Meet the residents: Ellie the Elephant (memory), Pip & Tweet the lovebirds (hash map), Foxy (running min), Pinchy the crab (two pointers), Kanga (Kadane's), Nutsy the squirrel (prefix/suffix)
👉 Next enclosure: Linked Lists. Subscribe so you don't miss it!
#DSA #Arrays #LeetCode #CodingInterview #Python #BigO #DataStructures #Algorithms