mirror of
https://github.com/Xevion/leetcode.git
synced 2025-12-06 05:15:30 -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:
|
with (directory / "meta.json").open("r") as meta_file:
|
||||||
meta = json.load(meta_file)
|
meta = json.load(meta_file)
|
||||||
|
|
||||||
solutions = " ".join(
|
solutions = ", ".join(
|
||||||
f"[{solution['name']}](/{(directory / solution['path']).relative_to(ROOT_DIRECTORY)})"
|
f"[{solution['name']}](/{(directory / solution['path']).relative_to(ROOT_DIRECTORY)})"
|
||||||
for solution in meta["solutions"]
|
for solution in meta["solutions"]
|
||||||
)
|
)
|
||||||
@@ -88,8 +88,8 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
question.id,
|
f"[{question.id}]({question.url})",
|
||||||
question.title,
|
f"[{question.title}]({question.url})",
|
||||||
solutions,
|
solutions,
|
||||||
question.difficulty,
|
question.difficulty,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ class Question(BaseModel):
|
|||||||
difficulty: str
|
difficulty: str
|
||||||
tags: List[Tag]
|
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):
|
class QuestionDatabase(object):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user