Files

49 lines
931 B
Org Mode
Raw Permalink Normal View History

2026-06-01 18:12:40 +08:00
#+ANKI_DECK: study_deck_02
* TODO 0131. Palindrome Partitioning :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0131. Palindrome Partitioning][0131. Palindrome Partitioning]]
:END:
Given a string ~s~, partition ~s~ such that every substring of the partition is a *palindrome*. Return /all possible palindrome partitioning of /~s~.
*Example 1:*
#+begin_src
Input: s = "aab"
Output: [["a","a","b"],["aa","b"]]
#+end_src
*Example 2:*
#+begin_src
Input: s = "a"
Output: [["a"]]
#+end_src
*Constraints:*
- ~1 <= s.length <= 16~
- ~s~ contains only lowercase English letters.
** TODO Approach
Write your approach here.
** TODO Python
2026-06-05 22:32:49 +08:00
#+begin_src python :lc-problem 131 :lc-lang python3
class Solution:
def partition(self, s: str) -> List[List[str]]:
#+end_src
** TODO C++
2026-06-05 22:32:49 +08:00
#+begin_src cpp :lc-problem 131
class Solution {
public:
vector<vector<string>> partition(string s) {
}
};
#+end_src