Add solution notes scaffold and sub-heading format
- roadmap.org: problems now have *** Python and *** C++ sub-headings, plus Notes: links to per-problem org files - scaffold-notes.mjs: creates 199 note files in org/cpp/dsa/<topic>/ with backlinks to roadmap.org - 18 topic folders under org/cpp/dsa/ for NeetCode 150 problems - Updated AGENTS.md with new conventions and workflow
This commit is contained in:
+15
-2
@@ -207,10 +207,19 @@ function buildOrg(sortedNodes, problemsByTopic) {
|
||||
const difficultyTag = (d) =>
|
||||
d === "Easy" ? "easy" : d === "Medium" ? "medium" : "hard";
|
||||
|
||||
const topicSlug = (name) =>
|
||||
name
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/(^-|-$)/g, "");
|
||||
|
||||
const notesRoot = "../../org/cpp/dsa";
|
||||
|
||||
for (const node of sortedNodes) {
|
||||
const topicProblems = (problemsByTopic[node.name] || []).filter(
|
||||
(p) => p.neetcode150
|
||||
);
|
||||
const slug = topicSlug(node.name);
|
||||
lines.push(`* TODO ${node.name} [/]`);
|
||||
lines.push("");
|
||||
|
||||
@@ -224,14 +233,18 @@ function buildOrg(sortedNodes, problemsByTopic) {
|
||||
const tag = difficultyTag(p.difficulty);
|
||||
const lcUrl = `${LEETCODE_BASE}${p.link}`;
|
||||
const num = p.code.split("-")[0];
|
||||
const notesFile = `${notesRoot}/${slug}/${p.code}.org`;
|
||||
lines.push(`** TODO ${num}. ${p.name} :${tag}:`);
|
||||
lines.push(`- Python: [[${GITHUB_SOLUTIONS}python/${p.code}.py][${p.code}.py]]`);
|
||||
lines.push(`- C++: [[${GITHUB_SOLUTIONS}cpp/${p.code}.cpp][${p.code}.cpp]]`);
|
||||
lines.push(`*** Python`);
|
||||
lines.push(`- [[${GITHUB_SOLUTIONS}python/${p.code}.py][${p.code}.py]]`);
|
||||
lines.push(`*** C++`);
|
||||
lines.push(`- [[${GITHUB_SOLUTIONS}cpp/${p.code}.cpp][${p.code}.cpp]]`);
|
||||
lines.push(`- LeetCode: [[${lcUrl}][${p.link}]]`);
|
||||
if (p.video)
|
||||
lines.push(
|
||||
`- Video: [[https://youtube.com/watch?v=${p.video}][explanation]]`
|
||||
);
|
||||
lines.push(`- Notes: [[${notesFile}][My Solution]]`);
|
||||
}
|
||||
lines.push("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user