Skip to content

Comments

feat(cogs/problems): get random problem from NeetCode problem lists#218

Merged
Kevin-Roman merged 4 commits intomainfrom
kevin/random-problem-from-list
Jul 14, 2025
Merged

feat(cogs/problems): get random problem from NeetCode problem lists#218
Kevin-Roman merged 4 commits intomainfrom
kevin/random-problem-from-list

Conversation

@Kevin-Roman
Copy link
Member

@Kevin-Roman Kevin-Roman commented Jul 13, 2025

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.

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.
Copy link

Copilot AI left a comment

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 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 NeetcodeSolution and parsing to include neetcode250 and build problem_lists in the bot
  • Update random_question_embed and question_embed to accept a ProblemList parameter and display list membership
  • Introduce ProblemList enum, configure slash command options, and initialize bot.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_TITLES but the list is referenced as blind_75. Rename to BLIND_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]:

@Kevin-Roman Kevin-Roman force-pushed the kevin/random-problem-from-list branch from 9056086 to dea622f Compare July 13, 2025 23:49
@Kevin-Roman Kevin-Roman changed the title temp feat(cogs/problems): random problem from NeetCode problem lists Jul 13, 2025
@Kevin-Roman Kevin-Roman force-pushed the kevin/random-problem-from-list branch from dea622f to 996973c Compare July 13, 2025 23:54
@Kevin-Roman Kevin-Roman force-pushed the kevin/random-problem-from-list branch from 996973c to c101905 Compare July 13, 2025 23:56
@Kevin-Roman Kevin-Roman changed the title feat(cogs/problems): random problem from NeetCode problem lists feat(cogs/problems): get random problem from NeetCode problem lists Jul 13, 2025
@Kevin-Roman Kevin-Roman merged commit 07caf99 into main Jul 14, 2025
1 check passed
@Kevin-Roman Kevin-Roman deleted the kevin/random-problem-from-list branch July 14, 2025 17:52
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.

Select random problem from LeetCode problem lists

1 participant