131. Palindrome Partitioning Leetcode Solution

Palindrome Partitioning Leetcode Problem :

Given a string s, partition s such that every substring of the partition is a palindrome . Return all possible palindrome partitioning of s.

Palindrome Partitioning Leetcode Solution :

Constraints :

  • 1 <= s.length <= 16
  • s contains only lowercase English letters.

Example 1:

  • Input: s = “a”
  • Output: [[“a”]]

Approach :

  • At every index, check if curr string is palindrome
  • If yes, then break string and add to partition and check for next index
  • Similarly, check by not breaking the string at current index

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Code :

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription