Dynamic Programming

Regular Expression Matching Leetcode Solution | Easy Approach

Regular Expression Matching Leetcode Solution | Given an input string s and a pattern p, implement regular expression matching with support for ‘.’ and ‘*’ where: ‘.’ Matches any single character.​​​​ ‘*’ Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Example 1: Input: s = “aa”, p = “a” Output: false Explanation: “a” does not match …

Regular Expression Matching Leetcode Solution | Easy Approach Read More »

Minimum Cost to Merge Stones

Longest Palindromic Substring LeetCode Solution | Easy Approach

Longest Palindromic Substring | Given a string s, return the longest palindromic substring in s. Example 1: Input: s = “babad” Output: “bab” Explanation: “aba” is also a valid answer. Example 2: Input: s = “cbbd” Output: “bb” Constraints: 1 <= s.length <= 1000 s consist of only digits and English letters. Solutions 1. Naive Approach ✅Time: O(n*n)✅Space: O(n) C++ Java Python …

Longest Palindromic Substring LeetCode Solution | Easy Approach Read More »

x