feat: populate note files with problem descriptions and code stubs
Add populate-notes.mjs that fetches problem descriptions and Python/C++ code stubs from LeetCode's GraphQL API. Populated all 197 NeetCode 150 note files with: - Problem description (examples, constraints) - Python code stub (function signature) - C++ code stub (function signature + includes) API responses cached in leetcode/.cache/leetcode/ for instant re-runs.
This commit is contained in:
@@ -1,18 +1,58 @@
|
||||
#+PROPERTY: STUDY_DECK_02
|
||||
* TODO 0763. Partition Labels :medium:
|
||||
:PROPERTIES:
|
||||
:NEETCODE: [[file:../../roadmap.org::*0763. Partition Labels][Roadmap]]
|
||||
:NEETCODE: [[file:../../roadmap.org::*0763. Partition Labels][0763. Partition Labels]]
|
||||
:END:
|
||||
|
||||
You are given a string ~s~. We want to partition the string into as many parts as possible so that each letter appears in at most one part. For example, the string ~"ababcc"~ can be partitioned into ~["abab", "cc"]~, but partitions such as ~["aba", "bcc"]~ or ~["ab", "ab", "cc"]~ are invalid.
|
||||
|
||||
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be ~s~.
|
||||
|
||||
Return /a list of integers representing the size of these parts/.
|
||||
|
||||
*Example 1:*
|
||||
|
||||
|
||||
#+begin_src
|
||||
Input: s = "ababcbacadefegdehijhklij"
|
||||
Output: [9,7,8]
|
||||
Explanation:
|
||||
The partition is "ababcbaca", "defegde", "hijhklij".
|
||||
This is a partition so that each letter appears in at most one part.
|
||||
A partition like "ababcbacadefegde", "hijhklij" is incorrect, because it splits s into less parts.
|
||||
#+end_src
|
||||
|
||||
|
||||
*Example 2:*
|
||||
|
||||
|
||||
#+begin_src
|
||||
Input: s = "eccbbbbdec"
|
||||
Output: [10]
|
||||
#+end_src
|
||||
|
||||
|
||||
*Constraints:*
|
||||
|
||||
- ~1 <= s.length <= 500~
|
||||
|
||||
- ~s~ consists of lowercase English letters.
|
||||
|
||||
** TODO Approach
|
||||
Write your approach here.
|
||||
|
||||
** TODO Python
|
||||
#+begin_src python
|
||||
|
||||
class Solution:
|
||||
def partitionLabels(self, s: str) -> List[int]:
|
||||
#+end_src
|
||||
|
||||
** TODO C++
|
||||
#+begin_src cpp
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> partitionLabels(string s) {
|
||||
|
||||
}
|
||||
};
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user