{"id":21515207,"url":"https://github.com/1git2clone/leetcode-trees-rs","last_synced_at":"2025-03-17T16:16:09.187Z","repository":{"id":241880259,"uuid":"808109161","full_name":"1Git2Clone/leetcode-trees-rs","owner":"1Git2Clone","description":"A Rust library for Binary Tree Node and Singly Linked List ListNode LeetCode problems.","archived":false,"fork":false,"pushed_at":"2024-05-30T12:04:30.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T02:33:07.991Z","etag":null,"topics":["crate","github-actions","gitlab-ci","leetcode","rust","rust-leetcode","rust-leetcode-solutions","rust-library"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/1Git2Clone.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":"2024-05-30T12:01:16.000Z","updated_at":"2024-05-30T12:07:21.000Z","dependencies_parsed_at":"2024-05-30T13:40:52.718Z","dependency_job_id":"b78f1b77-ac8f-4a19-9d5e-8b4e2ff906a1","html_url":"https://github.com/1Git2Clone/leetcode-trees-rs","commit_stats":null,"previous_names":["1git2clone/leetcode-trees-rs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Git2Clone%2Fleetcode-trees-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Git2Clone%2Fleetcode-trees-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Git2Clone%2Fleetcode-trees-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Git2Clone%2Fleetcode-trees-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1Git2Clone","download_url":"https://codeload.github.com/1Git2Clone/leetcode-trees-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066192,"owners_count":20392407,"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":["crate","github-actions","gitlab-ci","leetcode","rust","rust-leetcode","rust-leetcode-solutions","rust-library"],"created_at":"2024-11-23T23:54:34.573Z","updated_at":"2025-03-17T16:16:09.162Z","avatar_url":"https://github.com/1Git2Clone.png","language":"Rust","readme":"# LeetCode Trees in Rust\n\n[![GH_Build Icon]][GH_Build Status]\u0026emsp;[![Build Icon]][Build Status]\u0026emsp;[![Docs Icon]][Docs]\u0026emsp;[![Version Icon]][Crate]\u0026emsp;[![License Icon]][LICENSE]\u0026emsp;[![Coverage Icon]][Coverage]\n\n[GH_Build Icon]: https://img.shields.io/github/actions/workflow/status/1git2clone/leetcode-trees-rs/rust.yml?branch=main\n[GH_Build Status]: https://github.com/1git2clone/leetcode-trees-rs/actions?query=branch%3Amaster\n[Build Icon]: https://gitlab.com/1k2s/leetcode-trees-rs/badges/main/pipeline.svg\n[Build Status]: https://gitlab.com/1k2s/leetcode-trees-rs/-/pipelines\n[Docs Icon]: https://docs.rs/leetcode-trees-rs/badge.svg\n[Docs]: https://docs.rs/leetcode-trees-rs/latest/leetcode_trees_rs/\n[Version Icon]: https://img.shields.io/crates/v/leetcode-trees-rs.svg\n[Crate]: https://crates.io/crates/leetcode-trees-rs\n[License Icon]: https://img.shields.io/badge/license-MIT-blue.svg\n[LICENSE]: LICENSE\n[Coverage Icon]: https://gitlab.com/1k2s/leetcode-trees-rs/badges/main/coverage.svg\n[Coverage]: https://gitlab.com/1k2s/leetcode-trees-rs/badges/main/coverage.svg?job=coverage\n\n## Description\n\nThis library is made to make any LeetCoders using Rust have a better experience\nat solving their LeetCode (LC) problems. It uses `cargo make` to have\nreproducible sub-modules (check `leetcode-trees-rs/solutions/README.md`) as\nwell as implementing the definition of the binary trees on LC.\n\n---\n\nQuick start on using the library:\n\n## For `TreeNode` values (Binary Trees)\n\n```rust\nuse leetcode_trees_rs::{\n    prelude::*,\n    utils::{symmetric_tree, tree, TreeNode},\n};\n\nstruct Solution {} // Assigning an empty struct to make a solution impl block.\n\nuse std::{cell::RefCell, rc::Rc};\nimpl Solution {\n    pub fn your_leetcode_fn() {}\n}\n\n#[cfg(test)]\nmod tests {\n    #[test]\n    fn tests() {\n        // . . .\n    }\n}\n\nfn main() -\u003e Result\u003c()\u003e {\n    // Equivalent of:\n    //        1\n    //    2       2\n    //  3   3   3   3\n    let symmetric_tree_node = symmetric_tree!(1, 2, 3);\n\n    // Equivalent of:\n    //                   1\n    //         2                   #\n    //    3         3         #         #\n    // 4     #   #     #   #     #   #     #\n    let custom_tree = tree!(\u0026[\n        vec![Some(1)],\n        vec![Some(2), None],\n        vec![Some(3), Some(3)],\n        vec![Some(4)],\n    ]);\n\n    // If you want trees that only branch to the left or to the right then\n    // there're also the `left_tree!()` and `right_tree!()` macros!\n    // Those macros can help you write your test runs easier.\n\n    Ok(())\n}\n```\n\n---\n\n## For `ListNode` values (Singly Linked Lists)\n\n```rust\nuse leetcode_trees_rs::{list_node, prelude::*, utils::ListNode};\n\nstruct Solution {} // Assigning an empty struct to make a solution impl block.\n\nuse std::{cell::RefCell, rc::Rc};\nimpl Solution {\n    pub fn your_leetcode_fn() {}\n}\n\n#[cfg(test)]\nmod tests {\n    #[test]\n    fn tests() {\n        // . . .\n    }\n}\n\nfn main() -\u003e Result\u003c()\u003e {\n    // This is the very cumbersome manual way of writing your ListNode structs.\n    let some_list = ListNode {\n        val: 1,\n        next: Some(Box::new(ListNode {\n            val: 2,\n            next: Some(Box::new(ListNode::new(3))),\n        })),\n    };\n    // And this is the easier way:\n    let another_list = list_node!(1, 2, 3);\n\n    assert_eq!(some_list, another_list);\n\n    Ok(())\n}\n```\n\n## LICENSE\n\nThe project is licensed under the MIT license.\n\n## Extra notes\n\n---\n\nAdditional code templating can be found in [This template file](https://github.com/1Kill2Steal/leetcode-trees-rs/blob/main/solutions/lc0_general_nodes_template/src/main.rs).\n\nIt's located at: `solutions/lc0_general_nodes_template/src/main.rs`\n\n---\n\nAdditional documentation can be found in [docs.rs](https://docs.rs/leetcode-trees-rs/latest/leetcode_trees_rs/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1git2clone%2Fleetcode-trees-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1git2clone%2Fleetcode-trees-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1git2clone%2Fleetcode-trees-rs/lists"}