Coder Social home page Coder Social logo

leetcode-parse's Introduction

Leetcode Parse

License: Apache 2.0

Leetcode-parse is a project to crawl leetcode api. It's original intention is to provide a stable interface for the development of leetcode app. It will provide leetcode user login, algorithm lists, algorithm detail, comments, solution and discussion api and more.

Running locally

Before running, we need configure running environment.

Run environment

  • JDK (1.8 or later versions)
$ sudo apt install openjdk-8-jre-headless
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.10.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Generate jar

Leetcode-parse project provides leetcode_parse_demo.jar to run as demo. If you don't need provided leetcode_parse_demo.jar, you can generate the project jar in the following steps.

  • Clone down leetcode-parse and enter project root directory.
  • Enter service directory using cd service.
  • Run mvn clean install command. service-0.1.0-SNAPSHOT.jar is the target generated jar under service/target directory.

Run command

java -jar leetcode_parse_demo.jar

Request Api Sample

Get problem detail

POST http://localhost:8080/api/v1/problems

Request Params

Response Sample

{
    "code": 200,
    "message": null,
    "data": {
        "questionId": "1",
        "questionFrontendId": "1",
        "title": "Two Sum",
        "titleSlug": "two-sum",
        "content": "<p>Given an array of integers, return <strong>indices</strong> of the two numbers such that they add up to a specific target.</p>\r\n\r\n<p>You may assume that each input would have <strong><em>exactly</em></strong> one solution, and you may not use the <em>same</em> element twice.</p>\r\n\r\n<p><strong>Example:</strong></p>\r\n\r\n<pre>\r\nGiven nums = [2, 7, 11, 15], target = 9,\r\n\r\nBecause nums[<strong>0</strong>] + nums[<strong>1</strong>] = 2 + 7 = 9,\r\nreturn [<strong>0</strong>, <strong>1</strong>].\r\n</pre>\r\n\r\n<p>&nbsp;</p>\r\n",
        "difficulty": "Easy",
        "likes": 9638,
        "dislikes": 307,
        "stats": "{\"totalAccepted\": \"1.4M\", \"totalSubmission\": \"3.4M\", \"totalAcceptedRaw\": 1378682, \"totalSubmissionRaw\": 3437904, \"acRate\": \"40.1%\"}",
        "solution": {
            "canSeeDetail": true,
            "id": "7"
        },
        "metaData": "{\r\n  \"name\": \"twoSum\",\r\n  \"params\": [\r\n    {\r\n      \"name\": \"nums\",\r\n      \"type\": \"integer[]\"\r\n    },\r\n    {\r\n      \"name\": \"target\",\r\n      \"type\": \"integer\"\r\n    }\r\n  ],\r\n  \"return\": {\r\n    \"type\": \"integer[]\",\r\n    \"size\": 2\r\n  }\r\n}",
        "liked": null
    }
}

Contributing

We hope more developers to join. Here's the most direct way to contribute your work merged into leetcode-parse.

  • Fork the project from Github
  • Clone down your fork
  • Implement your feature or bug fix and commit changes
  • Push the branch up to your fork
  • Send a pull request to leetcode-parse master branch

Contract

You can contact me via email or wechat group:

Sample

leetcode-parse's People

Contributors

ahutsunshine avatar

Stargazers

 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.