Skip to content

hpwn/LeetCode-Solutions

Repository files navigation

🚀 Welcome to My LeetCode Journey! 🌌

Hello fellow coders! 👋 Welcome to my quirky and fun repository where I store all my solutions to LeetCode problems. Whether you're here to explore, learn, or just for a good laugh, you're in the right place! Let's dive into the magical world of coding challenges together. 🧙‍♂️✨

Setting Up the LeetCode Extension in VSCode

Before we start conquering challenges, let's set up our environment. I use Visual Studio Code (VSCode) with the LeetCode extension. It's like having a coding dojo right in your editor! 🥋💻 Here’s how you can set it up too:

  1. Install Visual Studio Code: If you haven’t already, download VSCode.

  2. Open VSCode Extensions: Click on the extensions icon in the sidebar or press Ctrl+Shift+X.

  3. Search for "LeetCode": Find the LeetCode extension by shengchen. It’s the one with a cool little ninja icon! 🥷

  4. Install the Extension: Just click 'Install'. Easy-peasy, lemon-squeezy!

  5. Login to LeetCode: Open the command palette (Ctrl+Shift+P), type LeetCode Sign In, and enter your credentials. If you're a ninja in disguise, make sure to use your stealthy login skills. 🐱‍👤

Initializing Your Own LeetCode Repo in VSCode

Now, let's get your personal LeetCode repository started! Here's a step-by-step guide to make it as smooth as butter on a hot pancake. 🥞

  1. Create a New Repo: If you haven't yet, create a new repository on GitHub. Give it a name that sparks joy!

  2. Clone the Repo in VSCode: In VSCode, press Ctrl+Shift+P, type Git: Clone, and paste your repo's URL. Choose a comfortable spot on your computer for it to live.

  3. Open Your Repo: After cloning, VSCode will ask if you want to open the repository. Go for it!

  4. Add a Remote: If you've started locally, add a remote pointing to your GitHub repo. Open the terminal in VSCode (`Ctrl+```) and type:

    git remote add origin YOUR_REPO_URL
    
  5. Start Adding Solutions: Now, whenever you solve a problem on LeetCode, add the solution to this repository. You can create a directory for each problem or organize it however you like – unleash your inner organizer! 📁✨

  6. Commit and Push: After adding your solutions, don't forget to commit and push your changes. Let the world see your awesome work!

    git add .
    git commit -m "Add solution for problem XYZ"
    git push origin master
    
  7. Rinse and Repeat: Keep solving, keep adding. Let this repo be a testament to your journey and growth!

Why Keep a LeetCode Repo?

  • 📚 Learning: Review your progress and solutions over time.
  • 🤝 Sharing: Help others learn from your solutions and approach.
  • 👀 Visibility: Show your problem-solving skills to the world (or maybe future employers!).

Let's Connect!

If you find this repo helpful or if you have suggestions, feel free to open an issue or submit a pull request. I'm always open to collaboration and learning from the community.

Happy coding, and may the code be ever in your favor! 🌟


⭐ Star this repo if you find it quirky, fun, or helpful. Happy LeetCode-ing! 😄🎉

Setting Up Debugging in TypeScript/JavaScript

Visual Studio Code

  1. Install Node.js: Ensure Node.js is installed on your system. This provides the runtime for running JavaScript outside a browser and is essential for debugging TypeScript/JavaScript projects.

  2. Configure launch.json:

    • In VSCode, navigate to the Debug view (Ctrl+Shift+D or Cmd+Shift+D on macOS).
    • Click on the "create a launch.json file" link and select the Node.js environment. This file tells VSCode how to launch and debug your application.
  3. Install TypeScript and ts-node (for TypeScript projects):

    • Run npm install typescript ts-node --save-dev in your project directory. ts-node allows you to run TypeScript files directly in Node.js.
  4. Debugging:

    • Set breakpoints in your code by clicking the left margin next to the line numbers in the editor.
    • Press F5 to start debugging. Use the debug controls to step through your code, inspect variables, and evaluate expressions.

Browser

For client-side JavaScript debugging:

  • Use Developer Tools in your preferred browser (e.g., Chrome DevTools, Firefox Developer Tools).
  • Open the DevTools (Ctrl+Shift+I or Cmd+Opt+I on macOS), go to the Sources tab, and set breakpoints directly in your JavaScript code.
  • Refresh your page to hit the breakpoints and step through your code.

Setting Up Debugging in Python

Visual Studio Code

  1. Install Python: Ensure Python is installed on your system and accessible from your terminal or command prompt.

  2. Configure launch.json:

    • In VSCode, open your Python project.
    • Go to the Debug view and click on "create a launch.json file", then select the Python environment.
    • Adjust the program path to point to the script you want to debug.
  3. Debugging:

    • Set breakpoints by clicking next to the line numbers.
    • Press F5 to start debugging. Use the debug controls to step over, into, or out of your code blocks.

Command Line

For a simpler setup or when working outside of VSCode, you can use pdb, the Python debugger:

import pdb; pdb.set_trace()
  • Insert the above line into your Python script at the point where you want to start debugging.
  • Run your script. Execution will pause at pdb.set_trace(), and you can use pdb commands (n for next, c for continue, etc.) to debug.

About

my leetcode solutions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published