Skip to content

feat: leetcode script - #145

Merged
QuBenhao merged 3 commits into
masterfrom
144-get-problem-by-category
Apr 26, 2025
Merged

QuBenhao merged 3 commits into
masterfrom
144-get-problem-by-category

Conversation

@QuBenhao

Copy link
Copy Markdown
Owner

add category selection and problem extraction from tags

add category selection and problem extraction from tags
@QuBenhao
QuBenhao requested a review from Copilot April 26, 2025 08:05
@QuBenhao QuBenhao linked an issue Apr 26, 2025 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new feature for LeetCode scripting that adds category selection and problem extraction from tags. Key changes include adding new functions (extract_problems and input_pick_array) in spider.py and leetcode.py, updating the user prompt for problem selection, and extending the get problem options to include a "Category" via option 5.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
python/scripts/spider.py Added new functions for holiday and problem extraction; updated the main entry.
python/scripts/leetcode.py Extended the problem selection prompt with a new "Category" option and added input_pick_array.
Comments suppressed due to low confidence (2)

python/scripts/leetcode.py:76

  • [nitpick] The prompt string in the 'input_pick_array' function is slightly ambiguous regarding the '0' option versus the 'random' default. Consider rephrasing it (for example, by separating the 'Back' option from the random selection instruction) to enhance clarity.
f"Enter the number of the {desc} [1-{len(arr)}, or 0 to go back or random [default: 0]: "

python/scripts/leetcode.py:223

  • [nitpick] The error message here could be more explicit. Consider rewording it to 'Failed to fetch the problem. Please verify that the problem ID {problem_id} is correct.' for improved user guidance.
print(f"Failed to fetch the problem. Check {problem_id} is correct?")

Comment thread python/scripts/spider.py Outdated
add argparse for command line interface in spider script
@QuBenhao
QuBenhao requested a review from Copilot April 26, 2025 08:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces additional problem extraction functionality and expands the LeetCode script to support category selection.

  • Added new functions in spider.py to extract problems from HTML content and support a dedicated subcommand.
  • Updated leetcode.py to include a new “Category” option in the problem retrieval prompt with supporting helper function for dynamic input selection.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
python/scripts/spider.py Added BeautifulSoup-based HTML problem extraction and a new subparser.
python/scripts/leetcode.py Updated get problem options to include category selection and added input_pick_array.

Comment thread python/scripts/spider.py Outdated
Comment thread python/scripts/leetcode.py Outdated
enhance problem extraction with error handling and argument parsing
@QuBenhao
QuBenhao merged commit 8ed9ea0 into master Apr 26, 2025
@QuBenhao
QuBenhao deleted the 144-get-problem-by-category branch April 26, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get problem by category

2 participants