https://python-hub.com/lets-face-dsa-together/
Here’s the question link on GFG: Longest Repeating Subsequence: https://www.geeksforgeeks.org/problems/longest-repeating-subsequence2004/1 Brute Force: RecursionOptimal: Dynamic Programming (LCS) — O(n²)Step 1: Create a DP tableStep 2: Fill the DP table Brute Force:…
Here’s the question link on Leetcode 13. Roman to Integer: https://leetcode.com/problems/roman-to-integer/description Brute Force: Handle All Subtraction CasesOptimal: Compare With the Next Character Brute Force: Handle All Subtraction Cases The straightforward…
Here’s the question link on Leetcode 3. Longest Substring Without Repeating Characters: https://leetcode.com/problems/longest-substring-without-repeating-characters/description Brute Force: Generate Every SubstringOptimal: Sliding Window + Hash Map O(n)Example Brute Force: Generate Every Substring The…
Here’s the question link on Leetcode 459. Repeated Substring Pattern: https://leetcode.com/problems/repeated-substring-pattern/description Brute Force: Try Every Possible SubstringOptimal: String Concatenation Trick Brute Force: Try Every Possible Substring The idea is to…
Here’s the question link on Leetcode 242. Valid Anagram: https://leetcode.com/problems/valid-anagram/description Brute Force - SortingOptimal - Frequency Counting Brute Force - Sorting The simplest approach is to sort both strings. If…