Skip to content

ReaVNaiL/LeetCode-Assistant

Repository files navigation

LeetCode Assistant

LeetCode Assistant is a powerful tool designed to help programmers prepare for technical interviews. It consists of a Discord bot that assigns LeetCode problems daily and an API that generates LeetCode problems based on their difficulty level. The bot not only assigns problems but also provides a variety of features to help users make the most out of their LeetCode practice.

Table of Contents

Features

The LeetCode Assistant is designed with a variety of features to streamline and enhance your LeetCode practice:

  • Daily Problem Assignment: The bot assigns daily LeetCode problems, helping users maintain a consistent practice schedule.
  • Difficulty-Based Problem Generation: The API can generate a list of problems based on the difficulty level, allowing users to focus their practice on specific difficulty tiers.
  • Top Problems: The bot provides the top 10 problems based on the frequency of the problems being asked in the past, helping users focus on commonly asked questions.
  • Random Problem Generation: The bot can provide a random problem based on the difficulty level, adding variety to the users' practice routine.

Getting Started

Prerequisites

Ensure you have the following installed on your local machine:

  • Node.js >= 10.13.0
  • npm >= 6.4.1
  • git >= 2.0.0

Installation

  1. Clone the repository:

    git clone https://github.com/ReaVNaiL/LeetCode-Generator-Discord-Bot/
    
  2. Install dependencies:

    npm install
    
  3. Install Lerna globally:

    npm install -g lerna
    
  4. Install the dependencies for each package using Lerna:

    lerna bootstrap
    
  5. Create a .env file in the root directory and add the following variables:

    discord_token=<your discord bot token>
    

Packages

The bot's code is divided into two main packages: discord-bot and leetcodeapi.

Discord-Bot

This package contains the code for the Discord bot itself. It uses axios for making HTTP requests, discord.js for interacting with Discord, dotenv for managing environment variables, node-cron for scheduling tasks, and pm2 for managing the application process.

⚠️ Note: The bot is using a date system to keep track of daily problems. At the time, this is hard coded, eventually I will allow users to set their own problem list, so they can start from the beginning of the list.

Snapshot of the bot in action:

  • Assigning a daily problem:

  • Example Bot Offline:

LeetCode-Api

This package contains the code for the LeetCode problem generation API. It uses axios for making HTTP requests, express for managing the server, express-winston for logging, and webpack for bundling the application.

See API Endpoints for more information on the API.

📓 Note: The API is hosted on Vercel. If you wish to host the API yourself, you will need to create a Vercel account and deploy the API to Vercel. Click here for more information on how to deploy to Vercel.

Usage

You can use various Lerna commands to manage the bot and the API:

  • lerna bootstrap: Installs all dependencies for all packages.
  • lerna run <script>: Run an npm script in each package that contains that script.

Contributing

Please see CONTRIBUTING.md for details on how to contribute to the project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Discord Bot that will assign leetcode problems daily.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published