mirror of
https://github.com/Xevion/leetcode.git
synced 2025-12-06 15:15:29 -06:00
Add URL question links to ID/Title, url property
This commit is contained in:
@@ -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,
|
||||
]
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user