From f4f8872c96fffe8747cae4327fdc867796c54725 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 8 Oct 2023 19:41:37 -0500 Subject: [PATCH] Add URL question links to ID/Title, url property --- .generate/main.py | 6 +++--- .generate/questions.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.generate/main.py b/.generate/main.py index 33dd046..f2dd264 100755 --- a/.generate/main.py +++ b/.generate/main.py @@ -77,7 +77,7 @@ def main(): with (directory / "meta.json").open("r") as meta_file: meta = json.load(meta_file) - solutions = " ".join( + solutions = ", ".join( f"[{solution['name']}](/{(directory / solution['path']).relative_to(ROOT_DIRECTORY)})" for solution in meta["solutions"] ) @@ -88,8 +88,8 @@ def main(): ) columns = [ - question.id, - question.title, + f"[{question.id}]({question.url})", + f"[{question.title}]({question.url})", solutions, question.difficulty, ] diff --git a/.generate/questions.py b/.generate/questions.py index 602c62a..c71f210 100644 --- a/.generate/questions.py +++ b/.generate/questions.py @@ -39,6 +39,13 @@ class Question(BaseModel): difficulty: str tags: List[Tag] + @property + def url(self) -> str: + """ + Gets the URL to the question. + """ + return f"https://leetcode.com/problems/{self.slug}" + class QuestionDatabase(object): """