Dashboard
LC #131

Palindrome Partitioning

Pattern · ?AmazonGoogleMeta

Problem

Partition a string such that every substring is a palindrome. Return all possible partitions.

Constraints

  • 1 ≤ s.length ≤ 16
  • s consists of lowercase English letters only

Example

Input
s = "aab"
Output
[["a","a","b"],["aa","b"]]
Why
"a","a","b" all palindromes. "aa" and "b" also palindromes

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗