In this video we solve LeetCode #5 — Longest Palindromic Substring, a classic medium that appears in interviews at top tech companies. You'll learn why every palindrome is anchored at a center, how expanding outward from that center finds every palindrome in O(n²) time and O(1) space, and why exactly two-n-minus-one centers cover the entire string with nothing missed and nothing double-counted. We also cover the subtle off-by-one on the slice after the while loop exits — the single most common implementation mistake — and exactly what to say to an interviewer about Manacher's algorithm without needing to implement it.
Chapters
00:00 Introduction
00:36 Problem Statement
01:35 Why Expand Around Center?
02:25 Interview Mindset & Clarifying Questions
03:25 Naive O(n³) Approach
04:19 The Key Insight — Odd & Even Centers
05:32 Step-by-Step Walkthrough
07:18 Python Code
08:37 Java Code
09:08 TypeScript Code
09:47 C++ Code
10:37 C# Code
11:07 Go Code
11:50 Complexity Analysis
12:37 What to Say Out Loud in an Interview
13:37 Pattern Review
#LeetCode #CodingInterview #Python #Algorithms #DynamicProgramming #TwoPointers #Palindrome #LongestPalindromicSubstring #TechInterview #SoftwareEngineering #ProgrammingTutorial #ExpandAroundCenter