{"id":20790703,"url":"https://github.com/beakerandjake/leetcode","last_synced_at":"2025-10-14T20:11:36.940Z","repository":{"id":216866279,"uuid":"603121329","full_name":"beakerandjake/leetcode","owner":"beakerandjake","description":"My leetcode solution repository","archived":false,"fork":false,"pushed_at":"2024-04-13T20:08:46.000Z","size":1400,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-13T21:51:24.487Z","etag":null,"topics":["leetcode","leetcode-javascript","leetcode-solutions"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beakerandjake.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":null,"dei":null}},"created_at":"2023-02-17T16:58:00.000Z","updated_at":"2024-04-16T19:45:19.645Z","dependencies_parsed_at":"2024-03-17T00:02:05.581Z","dependency_job_id":"cc559f22-6801-4459-93a1-265414e28ef4","html_url":"https://github.com/beakerandjake/leetcode","commit_stats":null,"previous_names":["beakerandjake/leetcode"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beakerandjake/leetcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beakerandjake%2Fleetcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beakerandjake%2Fleetcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beakerandjake%2Fleetcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beakerandjake%2Fleetcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beakerandjake","download_url":"https://codeload.github.com/beakerandjake/leetcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beakerandjake%2Fleetcode/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262438720,"owners_count":23311202,"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":["leetcode","leetcode-javascript","leetcode-solutions"],"created_at":"2024-11-17T15:37:00.766Z","updated_at":"2025-10-14T20:11:31.899Z","avatar_url":"https://github.com/beakerandjake.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leetcode\n\nContains my leetcode solutions.\n\nI don't like coding in a browser so I added tools to support local development:\n- Generate a solution file for the problem, with the problem description and blank code snippet. \n- Generate the test file and test cases for the problem.\n- Minify a problems source code and copy to clipboard so it can be submitted easily.\n- Reset the source of a previously solved problem so it can be practiced.\n\n# Usage\n\nClone the repository and install the packages: \n```sh\ngit clone https://github.com/beakerandjake/leetcode\ncd leetcode\nnpm install\n```\n\n## Commands\n\n### `test [problem-number]`\n\nRun the tests for all problems:\n\n```sh\nnpm run test\n```\n\nRun the test for a specific problem\n\n```sh\nnpm run test 42\n```\n\n### `touch [problem-slug|url] [--reset]`\n\nCreate the source and test file for the specified problem, commits these files to git, and finally opens them in vs code.\n\nThe source file is added to `src/` and test file is added to `tests/`.\n\nAn attempt is made to scrape the inputs and expected outputs from each example in the problem description. If scraping is successful a test case will be generated for each example and will provide the function with the correct inputs and test the result against the expected output. This process is not always successful so be sure to double check the generated test. \n\nTo touch the daily question, invoke with no arguments:\n```sh\nnpm run touch\n```\nIf touch is invoked with an argument, it should be either the problem slug or the full problem url.\n\nThe problem slug is located in the problems url `leetcode.com/problems/SLUG/...`\n\nTo touch problem #1 (https://leetcode.com/problems/two-sum) using the problem slug:\n```sh\nnpm run touch two-sum\n```\nTo touch problem #1 (https://leetcode.com/problems/two-sum) using the full url:\n```sh\nnpm run touch https://leetcode.com/problems/two-sum\n```\n\nAdditionally you can use the `--reset` flag to clear the existing source code for the problem. This is helpful if you want to practice the implementation. \n\n```sh\nnpm run touch two-sum -- --reset\n```\n\nNote the `--` is necessary to tell npm that the `--reset` flag is not for npm but for the `touch` command.\n\n### `uglify \u003cproblem-number\u003e`\n\nUglifies the problem source code outputs it to the console and attempts to copy it to the clipboard (if `xclip` is installed on the system). \n\nYou can paste this output into the leetcode editor and submit your solution.\n\nTo uglify problem 42:\n```sh\nnpm run uglify 42\n```\n\nAny additional arguments you pass to this command will be forwarded to uglify.js.\n\nFor example to tell uglify-js to not mangle quoted property names:\n```sh\nnpm run uglify 42 -- --mangle-props keep_quoted\n```\n\n### `info [problem-slug|url] [--reset]`\n\nReturns information about the specified problem, including the difficulty and number of likes/dislikes. Can optionally include the tags of the problem.\n\nIf provided no arguments, will return information about the problem of the day.\n\nTo get the info about a specific problem use the problem slug or url: \n\n```sh\nnpm run info two-sum\n```\n```sh\nnpm run info https://leetcode.com/problems/two-sum\n```\n\nTo include the tags in the output, use the `--tags` option:\n\n```sh\nrun info https://leetcode.com/problems/two-sum -- --tags\n```\n\n### `count`\n\nReturns the total number of problems that are in the src/ folder. \n\n```sh\nnpm run count\n```\n\n### `today`\n\nReturns the total number of problems that were created today. \n\n```sh\nnpm run today\n```\n\n### `ctci`\n\nReturns the number of problems solved out of the book [Cracking the Coding Interview](https://www.crackingthecodinginterview.com/)\n\nNote this isn't a perfect mapping, and a lot of problems in the book don't map to a leetcode problem, additionally I may have missed some problems while mapping.\n\n```sh\nnpm run ctci\n```\n\nAdditionally you can pass the `--remaining` flag to list the remaining problems:\n\n```sh\nnpm run ctci -- --remaining\n```\n\n## Authentication\n\nIf you have leetcode premium and wish to use the `touch` command with premium problems, you will need to authenticate. \n\nCreate an `.env` file at the root of the repository. Add an environment variable named `LEETCODE_SESSION_TOKEN` with the value set to your leetcode session cookie. \n\n```sh\necho 'LEETCODE_SESSION_TOKEN=YOURTOKENHERE' \u003e .env\n```\n\nThis file *should not* be committed to source control. It is ignored by default in the `.gitignore`\n\n# Acknowledgements\n\nBig thanks to the [leetcode-query](https://github.com/JacobLinCool/LeetCode-Query) package, it removed a lot of the copy and paste tedium when creating the source files for problems. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeakerandjake%2Fleetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeakerandjake%2Fleetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeakerandjake%2Fleetcode/lists"}