feat(cogs/problems): get random problem from NeetCode problem lists#218
Merged
Kevin-Roman merged 4 commits intomainfrom Jul 14, 2025
Merged
feat(cogs/problems): get random problem from NeetCode problem lists#218Kevin-Roman merged 4 commits intomainfrom
Kevin-Roman merged 4 commits intomainfrom
Conversation
There is a heap buffer overflow when writing a sufficiently large (>64k encoded with default settings) image in the DDS format due to writing into a buffer without checking for available space. This only affects users who save untrusted data as a compressed DDS image. - Unclear how large the potential write could be. It is likely limited by process segfault, so it's not necessarily deterministic. It may be practically unbounded. - Unclear if there's a restriction on the bytes that could be emitted. It's likely that the only restriction is that the bytes would be emitted in chunks of 8 or 16. This was introduced in Pillow 11.2.0 when the feature was added.
There was a problem hiding this comment.
Pull Request Overview
This PR integrates NeetCode-based problem lists into the bot, extends the solution model to track a 250-problem list, and updates commands and embeds so users can request random questions from these new lists.
- Extend
NeetcodeSolutionand parsing to includeneetcode250and buildproblem_listsin the bot - Update
random_question_embedandquestion_embedto accept aProblemListparameter and display list membership - Introduce
ProblemListenum, configure slash command options, and initializebot.problem_lists
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/neetcode.py | Add neetcode250, store and populate bot.problem_lists |
| src/ui/embeds/problems.py | Accept problem_list in random/question embeds and show membership |
| src/constants.py | Define ProblemList enum, NeetCodeBasedProblemList, and titles |
| src/cogs/problems.py | Add ProblemListField slash-command option and pass to embeds |
| src/bot.py | Initialize self.problem_lists in DiscordBot |
Comments suppressed due to low confidence (2)
src/constants.py:209
- The constant is named
GRIND_75_QUESTION_TITLESbut the list is referenced asblind_75. Rename toBLIND_75_QUESTION_TITLES(or similar) for consistency, or remove if unused.
GRIND_75_QUESTION_TITLES = {
src/utils/neetcode.py:44
- [nitpick] Using double underscores triggers name mangling and can hinder subclassing or introspection. Consider using a single underscore prefix for private methods instead.
async def __fetch_neetcode_solutions(self) -> dict[str, NeetcodeSolution]:
9056086 to
dea622f
Compare
dea622f to
996973c
Compare
996973c to
c101905
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add an option to select a random question from a specific problem list. For the scope of this PR, this includes only problem sets from NeetCode directly.
Also added to the problem embed footer which problem lists the problem is part of.
Space for generalisation has been made in the code to allow future implementation of LeetCode problem sets.