{"id":13471078,"url":"https://github.com/mbucko/openleetcode","last_synced_at":"2025-03-26T13:30:47.495Z","repository":{"id":223188224,"uuid":"759528813","full_name":"mbucko/openleetcode","owner":"mbucko","description":"An open source version of LeetCode","archived":false,"fork":false,"pushed_at":"2024-07-22T10:10:46.000Z","size":1187,"stargazers_count":24,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-30T02:58:17.639Z","etag":null,"topics":["c-plus-plus","cmake","interview","interview-preparation","interview-questions","java","leetcode","leetcode-cpp","python","qt"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbucko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-18T20:42:53.000Z","updated_at":"2024-10-27T12:13:16.000Z","dependencies_parsed_at":"2024-10-30T01:51:54.098Z","dependency_job_id":null,"html_url":"https://github.com/mbucko/openleetcode","commit_stats":null,"previous_names":["mbucko/openleetcode"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbucko%2Fopenleetcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbucko%2Fopenleetcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbucko%2Fopenleetcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbucko%2Fopenleetcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbucko","download_url":"https://codeload.github.com/mbucko/openleetcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245662735,"owners_count":20652073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cmake","interview","interview-preparation","interview-questions","java","leetcode","leetcode-cpp","python","qt"],"created_at":"2024-07-31T16:00:39.463Z","updated_at":"2025-03-26T13:30:46.676Z","avatar_url":"https://github.com/mbucko.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"OpenLeetCode - An open source version of LeetCode\n--------------------------------------------------------\nWelcome to the OpenLeetCode Project!\n\nThe motivation behind this project is to be able to practice LeetCode problems on a plane without requiring an internet connection (until Starlink ramps up). This project is not intended to replace or replicate leetcode.com.\n\n## Table of Content\n- [OpenLeetCode - An open source version of LeetCode](#openleetcode---an-open-source-version-of-leetcode)\n- [Table of Content](#table-of-content)\n- [Screenshot](#screenshot)\n- [Build](#build)\n\t- [Windows](#windows)\n\t\t- [Building without UI](#building-without-ui)\n\t\t- [Building with UI](#building-with-ui)\n\t- [Unix](#unix)\n\t\t- [Building without UI](#building-without-ui-1)\n\t\t- [Building with UI](#building-with-ui-1)\n- [Run](#run)\n\t- [Windows](#windows-1)\n\t\t- [CLI](#cli)\n\t\t- [UI](#ui)\n\t\t- [CLI](#cli-1)\n\t\t- [UI](#ui-1)\n- [How To Use](#how-to-use)\n- [List of LeetCode Problems](#list-of-leetcode-problems)\n- [Usage](#usage)\n- [Note](#note)\n- [Requirements](#requirements)\n\t\t- [Additional Requirements for the UI](#additional-requirements-for-the-ui)\n- [Contributing](#contributing)\n\n\n## Screenshot\n![Screenshot](assets/images/ui_screenshot.PNG)\n\n## Build\n### Windows\n#### Building without UI\n```cmd\ngit clone https://github.com/mbucko/openleetcode\ncd openleetcode\n.\\install --prefix=./install\n```\n#### Building with UI\n```cmd\ngit clone https://github.com/mbucko/openleetcode\ncd openleetcode\n.\\install --prefix=./install --enable_ui\n```\n### Unix\n#### Building without UI\n```bash\ngit clone https://github.com/mbucko/openleetcode\ncd openleetcode\n./install.sh --prefix=./install\n```\n#### Building with UI\n```bash\ngit clone https://github.com/mbucko/openleetcode\ncd openleetcode\n./install.sh --prefix=./install --enable_ui\n```\n## Run\n### Windows\n#### CLI\n```cmd\ndir install/OpenLeetCode\n./openleetcode --language cpp --problem TwoSum\n```\n#### UI\n```bash\ndir install/OpenLeetCode\n./openleetcodeui\n```\n### Unix\n#### CLI\n```bash\ncd install/OpenLeetCode\n./openleetcode.sh --language cpp --problem TwoSum\n```\n#### UI\n```bash\ncd install/OpenLeetCode\n./openleetcodeui.sh\n```\nNOTE: UI for unix is yet to be tested.\n\n## How To Use\nAfter the build succeeds, the following directory structure will be generated:\n\n- problems\n  - NumberOfIslands\n    - cpp\n      - solution.cpp\n      - ...\n    - testcases\n      - TestCase1.test\n      - TestCase2.test\n      - ...\n    - description.md\n  - TwoSum\n    - ..\n- launguage\n    - cpp\n\nJust like for LeetCode, you have one file where you solve the problem. For example, the problem called TwoSum has **problems/TwoSum/cpp/solution.cpp**. To add new test cases, you can create a file in the **problems/TwoSum/testcases/** directory with the file extension **.test**, and the solution will automatically be tested against it.\n\nEach problem is described in the ***description.md*** file location in the problem's directory. For example ***problems/TwoSum/description.md***.\n\nThe format of the .test files are as follows:\n\n```text\n\u003carg1\u003e\n\u003carg2\u003e\n\u003cexpected results\u003e\n```\n\nThe supported types are: integral type, a string, TreeNode structure, boolean or an array. For example:\n\n```text\n[\"1\", \"2\", \"4\"]\n8.0\n[0, 0]\n```\n\nA ThreeNode structure is represented in an array-based structure. For example an array representation `[1, 2, null, null, 3]` results to the following structure:\n\n      1\n     / \\\n    2   3\n\n## List of LeetCode Problems\n* TwoSum\n* LongestSubstringWithoutRepeatingCharacters\n* NumberOfIslands\n* CheckCompletenessOfABinaryTree\n\nThe problem names are automatically extracted from the **problems** folder.\n\n## Usage\n```text\n$ python openleetcode.py --help\nusage: openleetcode.py [-h] [--language {cpp}] [--list-problems] [--list-testcases] [--problem problem_name] [--problem_builds_dir dir] [--testcase testcase_name] [--verbose]\n\nOpenLeetCode problem builder. This script builds and tests LeetCode-like problems locally. Currently, it only supports the C++ language, but it can be extended to support other languages.\n\noptions:\n  -h, --help            show this help message and exit\n  --language {cpp}, -l {cpp}\n                        The programming language.\n  --list-problems       List problems.\n  --list-testcases      List testcases for a problem specified with '--problem' option.\n  --problem problem_name, -p problem_name\n                        Name of the problem to build and test. Default: TwoSum. Use --list-problems to list all problems.\n  --problem_builds_dir dir, -d dir\n                        Specifies the directory with the problems. Typically, this is './problem_builds'. If not provided, the script defaults to './problem_builds' in the same directory as the executable.\n  --run-expected-tests, -r\n                        Run the expected solution. Default: False.\n  --testcase testcase_name, -t testcase_name\n                        Name of the testcase to run. '--testcase All' will run all testcases. Default: All.\n  --verbose, -v         Print verbose output\n```\n\n## Note\nCurently only C++ is supported but the framework is setup such that other languages can be added.\n\n## Requirements\nThis project requires the following to run:\n\n- Python\n- CMake 3.12\n- Git\n\n#### Additional Requirements for the UI\n- npm\n\n## Contributing\nFeel free to contribute with code, test cases, or even code reviews.\n\nFor a more in-depth guide on how to contribute and information about the inner workings of OpenLeetCode, please refer to the [Docs](docs/index.md).\nYou can also join our [Discord chat](https://discord.gg/BzkqubYUm8) if you have any questions about the usage or development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbucko%2Fopenleetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbucko%2Fopenleetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbucko%2Fopenleetcode/lists"}