{"id":22196968,"url":"https://github.com/hesic73/snippets","last_synced_at":"2025-03-24T22:41:28.658Z","repository":{"id":214256832,"uuid":"736072199","full_name":"hesic73/snippets","owner":"hesic73","description":"A bunch of C++ code snippets for tackling LeetCode problems","archived":false,"fork":false,"pushed_at":"2024-10-25T01:00:30.000Z","size":1721,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T20:44:44.030Z","etag":null,"topics":["c-plus-plus","cplusplus","cpp"],"latest_commit_sha":null,"homepage":"https://hesic73.github.io/snippets","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/hesic73.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,"publiccode":null,"codemeta":null}},"created_at":"2023-12-26T23:01:23.000Z","updated_at":"2024-10-25T01:00:34.000Z","dependencies_parsed_at":"2024-02-12T09:47:30.053Z","dependency_job_id":"47fa30a9-7e0b-4e25-bf45-d2e214edabda","html_url":"https://github.com/hesic73/snippets","commit_stats":null,"previous_names":["hesic73/snippets"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hesic73%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hesic73%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hesic73%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hesic73%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hesic73","download_url":"https://codeload.github.com/hesic73/snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245366207,"owners_count":20603438,"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","cplusplus","cpp"],"created_at":"2024-12-02T14:17:55.942Z","updated_at":"2025-03-24T22:41:28.638Z","avatar_url":"https://github.com/hesic73.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# snippets\n![tests](https://github.com/hesic73/snippets/actions/workflows/tests.yml/badge.svg)\n![Static Badge](https://img.shields.io/badge/std-c%2B%2B20-blue)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/hesic73/snippets/master/LICENSE)\n\n(hopefully) useful code snippets for LeetCode.\n\n## Overview\n\n| file                   | description                                                  |\n|------------------------| ------------------------------------------------------------ |\n| modular_arithmetic.hpp | `MODULO` is fixed, which is enough for LeetCode.             |\n| number_utils.hpp       |                                                              |\n| varadic_numeric.hpp    |                                                              |\n| sorted_utils.hpp       |                                                              |\n| binary_tree.hpp        |                                                              |\n| linked_list.hpp        |                                                              |\n| graph.hpp              | with the help of GPT-4                                       |\n| string_utils.hpp       | with the help of GPT-4                                       |\n| monotonic_stack.hpp    |                                                              |\n| dominant_tracker.hpp   | [LeetCode 2780](https://leetcode.com/problems/minimum-index-of-a-valid-split/description/) |\n| segment_tree.hpp       | adapted from https://oi-wiki.org/ds/seg/                     |\n| sliding_window.hpp     | with the help of GPT-4                                       |\n| interval.hpp           | Initially, I aimed for a simplified interval tree, but it turned out differently. Although it's not thoroughly tested and might have some bugs, I managed to use it successfully to solve LeetCode 218's Skyline Problem. Check out the solution here: [LeetCode Submission](https://leetcode.com/problems/the-skyline-problem/submissions/1172986139/). |\n| disjoint_set.hpp       | with the help of GPT-4                                       |\n| big_integer.hpp        | with the help of GPT-4                                       |\n\n## Usage\n\nTo incorporate `snippets` into your C++ project, you can use CMake's `FetchContent` module as shown below:\n\n```cmake\ncmake_minimum_required(VERSION 3.11)\nproject(YourProject)\n\ninclude(FetchContent)\nFetchContent_Declare(\n    snippets\n    GIT_REPOSITORY https://github.com/hesic73/snippets.git\n    GIT_TAG        main  # or any specific tag/version you prefer\n)\nFetchContent_MakeAvailable(snippets)\n\nadd_executable(YourApplication ...)\ntarget_link_libraries(YourApplication PRIVATE snippets)\n```\n\nYou can then include the desired header files from `snippets` directly in your project's source files:\n\n```C++\n#include \u003ciostream\u003e\n#include \"big_integer.h\"\n\nint main() {\n    auto a = hsc_snippets::BigInteger::factorial(100);\n    auto b = hsc_snippets::BigInteger::pow(hsc_snippets::BigInteger::from_integer(3), 100);\n    std::cout \u003c\u003c a.to_string() \u003c\u003c std::endl;\n    std::cout \u003c\u003c b.to_string() \u003c\u003c std::endl;\n}\n```\n\n## Running Tests\n\nThe test appears in this manner:\n\n```bash\nmkdir -p build\ncd build\ncmake ..\ncmake --build . --config Release\nctest -V -C Release\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhesic73%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhesic73%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhesic73%2Fsnippets/lists"}