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:
2026-06-01 17:22:07 +08:00
parent e798e449bd
commit 1dec88aaf2
198 changed files with 10459 additions and 534 deletions
@@ -1,18 +1,58 @@
#+PROPERTY: STUDY_DECK_02
* TODO 0424. Longest Repeating Character Replacement :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0424. Longest Repeating Character Replacement][Roadmap]]
:NEETCODE: [[file:../../roadmap.org::*0424. Longest Repeating Character Replacement][0424. Longest Repeating Character Replacement]]
:END:
You are given a string ~s~ and an integer ~k~. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most ~k~ times.
Return /the length of the longest substring containing the same letter you can get after performing the above operations/.
*Example 1:*
#+begin_src
Input: s = "ABAB", k = 2
Output: 4
Explanation: Replace the two 'A's with two 'B's or vice versa.
#+end_src
*Example 2:*
#+begin_src
Input: s = "AABABBA", k = 1
Output: 4
Explanation: Replace the one 'A' in the middle with 'B' and form "AABBBBA".
The substring "BBBB" has the longest repeating letters, which is 4.
There may exists other ways to achieve this answer too.
#+end_src
*Constraints:*
- ~1 <= s.length <= 10^{5}~
- ~s~ consists of only uppercase English letters.
- ~0 <= k <= s.length~
** TODO Approach
Write your approach here.
** TODO Python
#+begin_src python
class Solution:
def characterReplacement(self, s: str, k: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
class Solution {
public:
int characterReplacement(string s, int k) {
}
};
#+end_src