Coder Social home page Coder Social logo

arav12ind / leetcode-problem-solving-22-23 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmacs-mtech-2022-24/leetcode-problem-solving-22-23

0.0 0.0 0.0 957 KB

II MTech 2023-24 leetcode problem's solution

Python 4.02% C++ 86.70% Java 4.14% C 5.15%
dsa-practice leetcode leetcode-solutions

leetcode-problem-solving-22-23's Introduction

leetcode-problem-solving-22-23

II MTech 2023-24 leetcode problem's solution

This program, lc.py, dumps your accepted submission codes and updates a table in your local system. This program stores and updates a timestamp. This timestamp is used to choose only the submissions newer than the timestamp. It updates this timestamp at the end of the program. You will have to commit and push these updates to GitHub remote repository by yourself.

Usage Instructions

Fork the GitHub repository.

Fork

Only the first time, clone the forked repository using VS Code by opening a new window and clicking on Clone Git Repository. Provide it with the details it is asking for.

First create info.json file

The program needs the info.json file in the current working directory. Create this file. The content below is a template and is not to be used as is.

{
    "num_retries": 10,
    "retry_wait": 5,
    "code_path": "codes",
    "problems_url": "https://leetcode.com/problems/",
    "graphql_url": "https://leetcode.com/graphql/",
    "file_unicode_symbol": "📁",
    "data_file": "data.pkl",
    "readme_path": "README.adoc",
    "timestamp_file": "timestamp",
    "limit": 10,
    "note_replaces": {
        "\n": " +\n",
        "|": "\\|"
    },
    "colour_map": {
        "Easy": "green-background",
        "Medium": "yellow-background",
        "Hard": "red-background"
    },
    "submissions_path": "README.adoc",
    "reg": "Your Registration Number",
    "name": "Your Name",
    "LEETCODE_SESSION": "LEETCODE_SESSION from browser cookies",
    "csrftoken": "csrftoken from browser cookies"
}

Change the values for the following entries.
reg, name, LEETCODE_SESSION, csrftoken.
The value of reg is your registration number and the value of name is your name The LEETCODE_SESSION and csrftoken can be found by using a cookie editor extension on a browser.
Use it when opening the leetcode.com after login.
This cookie editor will give the LEETCODE_SESSION and csrftoken values.
These values must be put in the info.json file and must be enclosed with double quotes.

cookie_editor

Here is an example info.json file. This too should not be used as is, it is an example.

{
    "num_retries": 10,
    "retry_wait": 5,
    "code_path": "codes/",
    "problems_url": "https://leetcode.com/problems/",
    "graphql_url": "https://leetcode.com/graphql/",
    "file_unicode_symbol": "📁",
    "data_file": "data.pkl",
    "timestamp_file": "timestamp",
    "readme_path": "README.adoc",
    "limit": 10,
    "note_replaces": {
        "\n": " +\n",
        "|": "\\|"
    },
    "colour_map": {
        "Easy": "green-background",
        "Medium": "yellow-background",
        "Hard": "red-background"
    },
    "submissions_path": "README.adoc",
    "reg": "123456",
    "name": "Sai Ram",
    "LEETCODE_SESSION": "eyJ0eYAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfYXV0aF91c2VyX2lkIjoiNDT3NzZzNCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImFsbGF1dGguYWNjb3VudC5hdXRoX2JhY1tlbmRzLkF1dGhlbnRpY2F0aW9uQmFja2VuZCIsIl9hdXRoX3VzZXJfaGFzaCI6Ijg0YTgyMrg1Mzk3ZWE1NjAwZGVjNWJlNzBmYjZhMGZhOWJhY2E4NTUiLCJpZCI6NDY3NzMzNCwiZW1haWwiOiJzYWlhcmF2aW5kLnN2QGdtYWlsLmNvbSIsInVzZXJuYW1lIjoiYXJhdjEyaW5kIiwidXNpcl9zbHVnIjoiYXJhdjEyaW5kIiwiYXZhdGFyIjoiaHR0cHM6Ly9hc3NldHMubGVldGNvZGUuY29tL3VzZXJzL2FyYXYxMmluZC9hdmF0YXJfMTYyNzkxMDk0Mi5wbmciLCJyZWZyZXNoqohfYXQiOjE2OTYzOTc2OTgsImlwIjoiMTQuMTM5Ljg2LjU0IiwiaWRlbnRpdHkiOiI2ZDc5N2EzZDIxZWIzMGMzYWYwNThhYjNhMmJmNTYyZCIsInNlc3Npb25faWQiOjQ1MDQzODcyfQ.oF6DWNUmPpZhQNJ939fF9og0FOlwyFbJT-zCukWksFo",
    "csrftoken": "yYUukQCy1O2CnjwOVKkfyjBOobsTs619AqXu9XdRgE4TpLhvGhwg3nIi8IouXO74"
}

Now run

python lc.py -g

The script has three options, -g, -n and -r.

  • The option -g gets new submission from leetcode and updates the data.pkl file. It then rebuilds the README file.
  • The option -n updates the notes it has stored in the data.pkl file and then rebuilds the README file.
  • The options r rebuilds the README file.
  • Exactly one of these options must be provided at the launch of the program.

If the program exits due to some value being none, even after retying many times, then the problem is either due to internet or due to expiration of LEETCODE_SESSION and csrftoken. If it is confirmed that the problem is not due to internet then, refresh the LEETCODE_SESSION and csrftoken values by again getting those values from the brwoser's cookie editor extension.

Each time you will push your submissions only to your forked repository. You can do a pull request to apply these changes to the original repository.

Whenever a submission is made, remember to write notes for it in the leetcode itself.

notes save_notes

leetcode-problem-solving-22-23's People

Contributors

arav12ind avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.