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,65 @@
|
||||
#+PROPERTY: STUDY_DECK_02
|
||||
* TODO 0125. Valid Palindrome :easy:
|
||||
:PROPERTIES:
|
||||
:NEETCODE: [[file:../../roadmap.org::*0125. Valid Palindrome][Roadmap]]
|
||||
:NEETCODE: [[file:../../roadmap.org::*0125. Valid Palindrome][0125. Valid Palindrome]]
|
||||
:END:
|
||||
|
||||
A phrase is a *palindrome* if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
|
||||
|
||||
Given a string ~s~, return ~true~/ if it is a *palindrome*, or /~false~/ otherwise/.
|
||||
|
||||
*Example 1:*
|
||||
|
||||
|
||||
#+begin_src
|
||||
Input: s = "A man, a plan, a canal: Panama"
|
||||
Output: true
|
||||
Explanation: "amanaplanacanalpanama" is a palindrome.
|
||||
#+end_src
|
||||
|
||||
|
||||
*Example 2:*
|
||||
|
||||
|
||||
#+begin_src
|
||||
Input: s = "race a car"
|
||||
Output: false
|
||||
Explanation: "raceacar" is not a palindrome.
|
||||
#+end_src
|
||||
|
||||
|
||||
*Example 3:*
|
||||
|
||||
|
||||
#+begin_src
|
||||
Input: s = " "
|
||||
Output: true
|
||||
Explanation: s is an empty string "" after removing non-alphanumeric characters.
|
||||
Since an empty string reads the same forward and backward, it is a palindrome.
|
||||
#+end_src
|
||||
|
||||
|
||||
*Constraints:*
|
||||
|
||||
- ~1 <= s.length <= 2 * 10^{5}~
|
||||
|
||||
- ~s~ consists only of printable ASCII characters.
|
||||
|
||||
** TODO Approach
|
||||
Write your approach here.
|
||||
|
||||
** TODO Python
|
||||
#+begin_src python
|
||||
|
||||
class Solution:
|
||||
def isPalindrome(self, s: str) -> bool:
|
||||
#+end_src
|
||||
|
||||
** TODO C++
|
||||
#+begin_src cpp
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
bool isPalindrome(string s) {
|
||||
|
||||
}
|
||||
};
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user