LeetCode Challenge: Regular Expression Matching with Dynamic Programming

Day 32/100 – LeetCode Challenge 🚀 Problem: Regular Expression Matching Approach: Used 2D Dynamic Programming Defined dp[i][j] as whether s[0..i) matches p[0..j) Handled: . → matches any character * → zero or more occurrences of previous character Time Complexity: O(m × n) Space Complexity: O(m × n) Key takeaway: When pattern rules affect previous characters (like *), dynamic programming is often required instead of greedy logic. #LeetCode #100DaysOfCode #DSA #Java #DynamicProgramming #InterviewPrep

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories