Перейти к содержимому

Palindromic Substrings | Count All Palindromes | Brute Force + Optimal (Python, C++, Java)

RisingBrain

0:00 / 0:00

Palindromic Substrings | Count All Palindromes | Brute Force + Optimal (Python, C++, Java)

6 349 просмотров · 5 месяцев назад
RisingBrain
41,1 тыс. подписчиков
6 349 просмотров · 5 месяцев назад
In this video, we solve the Palindromic Substrings problem from LeetCode, where we need to count all possible palindromic substrings in a given string. We begin with the brute force approach to build intuition and understand how substrings work, then move to the optimal solution using the expand around center technique. You will learn: What exactly is a palindromic substring Difference between substring and subsequence Brute force approach and why it is inefficient Optimal expand around center approach (O(n²)) How to count all palindromes efficiently Clean and interview-ready code in Python, C++, and Java This is a very important string problem frequently asked in coding interviews and helps strengthen your understanding of two pointers and string traversal. Rising Brain (DSA Sheet): https://www.risingbrain.org/sheet Connect with me here: LinkedIn –   / anjalikumari22   Instagram –   / rbanjali.codes   Twitter (X) – https://x.com/anjali1kumari?s=21