{"id":20448021,"url":"https://github.com/yi-ge/rust-practice","last_synced_at":"2026-04-09T13:03:01.754Z","repository":{"id":60275744,"uuid":"522233939","full_name":"yi-ge/rust-practice","owner":"yi-ge","description":"Rust 算法练习。","archived":false,"fork":false,"pushed_at":"2024-01-30T02:11:24.000Z","size":49697,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T01:12:44.368Z","etag":null,"topics":["algorithm","data-structures","rust","rust-lang"],"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/yi-ge.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":"2022-08-07T14:23:02.000Z","updated_at":"2025-04-02T09:30:32.000Z","dependencies_parsed_at":"2024-11-15T10:43:33.028Z","dependency_job_id":null,"html_url":"https://github.com/yi-ge/rust-practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yi-ge%2Frust-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yi-ge%2Frust-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yi-ge%2Frust-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yi-ge%2Frust-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yi-ge","download_url":"https://codeload.github.com/yi-ge/rust-practice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650754,"owners_count":21139681,"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":["algorithm","data-structures","rust","rust-lang"],"created_at":"2024-11-15T10:31:56.761Z","updated_at":"2026-04-09T13:03:01.646Z","avatar_url":"https://github.com/yi-ge.png","language":"Rust","readme":"# Rust练习\n\n[![license](https://img.shields.io/github/license/yi-ge/rust-practice.svg?style=flat-square)](https://github.com/yi-ge/rust-practice/blob/master/LICENSE)\n[![GitHub Actions](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fyi-ge%2Frust-practice%2Fbadge%3Fref%3Dmain\u0026style=flat-square)](https://actions-badge.atrox.dev/yi-ge/rust-practice/goto?ref=main)\n[![Test Results](https://gist.github.com/yi-ge/00fdcacb47689d14b8e9fdf7fb0f7288/raw/badge.svg)](https://github.com/yi-ge/rust-practice)\n[![Coveralls github](https://img.shields.io/coveralls/github/yi-ge/rust-practice?style=flat-square)](https://coveralls.io/github/yi-ge/rust-practice)\n[![GitHub last commit](https://img.shields.io/github/last-commit/yi-ge/rust-practice.svg?style=flat-square)](https://github.com/yi-ge/rust-practice)\n[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod\u0026style=flat-square)](https://gitpod.io/#https://github.com/yi-ge/rust-practice)\n\nRust 基础算法、数据结构练习，包含 LeetCode 或其它算法练习记录。\n\n此为个人练习仓库，代码中对重要思想进行了注释，会尽量补充解题思路。\n\n每一道题都对应写有测试用例，但可能不够完整。如果您发现错误，欢迎给我留言，谢谢！\n\n安装以下测试环境后，运行`yarn start`可以自动从LeetCode获取代码函数和用例说明。保存文件后将自动同步到浏览器。\n\n特别说明：题目截图仅为了方便在代码编辑器中直接预览从而优化编码体验，题目以LeetCode官方页面为准，题目著作权及其他权利以LeetCode官方说明为准或属于LeetCode。请大家尊重版权，共同维护良好网络环境。\n\n## 测试环境\n\n安装最新版[Rust](https://www.rust-lang.org/)、[Node.js](https://nodejs.org)和[Python3](https://www.python.org/)。安装完成后执行`yarn`安装依赖。\n\n### 非CI环境的Linux x86平台下\n\n单元覆盖率测试依赖：`cargo install cargo-watch cargo-tarpaulin`以及`VSCode`插件[Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters)。\n\n执行命令`cargo watch -x 'tarpaulin --ignore-tests --out Lcov' -i lcov.info`，可以在`VSCode`中查看覆盖情况。\n\n可[参考](https://dev.to/marcoieni/2-videos-about-rust-code-coverage-in-vscode-38kf)进行覆盖率测试。\n\n### 非CI环境的MacOS x86/ARM平台下\n\n需要安装`nightly`版本的构建工具用于单元覆盖率测试（仅用于单元覆盖率测试，否则可以使用`stable`版本）。\n\n如果已经通过`brew`安装了rust，可以先`brew uninstall rust`再执行`brew install rustup-init`安装`rustup-init`。执行`rustup-init`就有了`rustup`。后续通过`rustup`管理`rust`版本（如非覆盖率测试必要，仍然建议使用`brew install rust`安装稳定的`rust`版本）。\n\n设置为`nightly`版本：\n\n```bash\nrustup default nightly\n```\n\n安装覆盖率测试相关依赖：\n\n```bash\nrustup component add llvm-tools-preview\ncargo install grcov\n```\n\n执行本地覆盖率测试（在HTML中查看）：\n\n```bash\ncargo xtask coverage --dev\n```\n\n安装`VSCode`插件[Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters)。执行本地覆盖率测试（`VSCode`中查看）：\n\n```bash\ncargo xtask coverage\n```\n\n右键：`Coverage Gutters: Display Coverage`。\n\n## 基础排序算法\n\n- [冒泡排序](src/sort/bubble_sort.rs)\n- [插入排序](src/sort/insert_sort.rs)\n- [选择排序](src/sort/select_sort.rs)\n- [堆排序](src/sort/heap_sort.rs)\n- [快速排序](src/sort/quick_sort.rs)\n- [归并排序](src/sort/merge_sort.rs)\n\n## 基础数据结构\n\n### Rust标准库中的数据结构\n\nRust标准库`std::collections`提供了4种通用容器类型，包含一下8种数据结构。\n\n| 类型     | 容器        | 描述                     |\n| -------- | :---------- | ------------------------ |\n| 线性序列 | Vec\\\u003cT\u003e      | 连续存储的可变长数组     |\n| 线性序列 | VecDeque\\\u003cT\u003e | 连续存储的可变长双端队列 |\n| 线性序列 | LinkedList\\\u003cT\u003e | 非连续存储的双向链表 |\n| 键 - 值对 | HashMap\\\u003cK, V\u003e | 基于哈希表的无序键 - 值对 |\n| 键 - 值对 | BTreeMap\\\u003cK, V\u003e | 基于B树的有序键 - 值对，按 Key 排序 |\n| 集合 | HashSet\\\u003cT\u003e | 基于哈希表的无序集合 |\n| 集合 | BTreeSet\\\u003cT\u003e | 基于B树的有序集合 |\n| 优先队列 | BinaryHeap\\\u003cT\u003e | 基于二叉堆的优先队列 |\n\n### 通过Rust实现的数据结构及其常见操作\n\n- [链表结点](src/libs/list_node.rs)\n- [链表操作](src/libs/list.rs)\n- [树结点](src/libs/tree_node.rs)\n- [二叉树的前序遍历](src/tree/binary_tree_preorder_traversal.rs)\n- [二叉树的中序遍历](src/tree/binary_tree_inorder_traversal.rs)\n- [二叉树的后序遍历](src/tree/binary_tree_postorder_traversal.rs)\n- [二叉树的层序遍历](src/tree/binary_tree_level_order_traversal.rs)\n- [堆化、插入及删除堆元素](src/libs/heap.rs)\n\n## 算法题\n\n### 字符串\n\n- [构造限制重复的字符串](src/string/construct_string_with_repeat_limit.rs)  [贪心, 字符串, 计数, 堆（优先队列）]\n\n  - LeetCode 2182. 构造限制重复的字符串 \u003chttps://leetcode.cn/problems/construct-string-with-repeat-limit\u003e\n\n- [统计重复个数](src/string/count_the_repetitions.rs)  [字符串, 动态规划]\n\n  - LeetCode 466. 统计重复个数 \u003chttps://leetcode.cn/problems/count-the-repetitions\u003e\n\n- [字典序最小回文串](src/string/lexicographically_smallest_palindrome.rs)  [贪心, 双指针, 字符串]\n\n  - LeetCode 2697. 字典序最小回文串 \u003chttps://leetcode.cn/problems/lexicographically-smallest-palindrome\u003e\n\n- [子串能表示从 1 到 N 数字的二进制串](src/string/binary_string_with_substrings_representing_1_to_n.rs)  [字符串]\n\n  - LeetCode 1016. 子串能表示从 1 到 N 数字的二进制串 \u003chttps://leetcode.cn/problems/binary-string-with-substrings-representing-1-to-n\u003e\n\n- [有效时间的数目](src/string/number_of_valid_clock_times.rs)  [字符串, 枚举]\n\n  - LeetCode 2437. 有效时间的数目 \u003chttps://leetcode.cn/problems/number-of-valid-clock-times\u003e\n\n- [数青蛙](src/string/minimum_number_of_frogs_croaking.rs)  [字符串, 计数]\n\n  - LeetCode 1419. 数青蛙 \u003chttps://leetcode.cn/problems/minimum-number-of-frogs-croaking\u003e\n\n- [按字典序排在最后的子串](src/string/last_substring_in_lexicographical_order.rs)  [双指针, 字符串]\n\n  - LeetCode 1163. 按字典序排在最后的子串 \u003chttps://leetcode.cn/problems/last-substring-in-lexicographical-order\u003e\n\n- [段式回文](src/string/longest_chunked_palindrome_decomposition.rs)  [贪心, 双指针, 字符串, 动态规划, 哈希函数, 滚动哈希]\n\n  - LeetCode 1147. 段式回文 \u003chttps://leetcode.cn/problems/longest-chunked-palindrome-decomposition\u003e\n\n- [隐藏个人信息](src/string/masking_personal_information.rs)  [字符串]\n\n  - LeetCode 831. 隐藏个人信息 \u003chttps://leetcode.cn/problems/masking-personal-information\u003e\n\n- [最短公共超序列](src/string/shortest_common_supersequence.rs)  [字符串, 动态规划]\n\n  - LeetCode 1092. 最短公共超序列 \u003chttps://leetcode.cn/problems/shortest-common-supersequence\u003e\n\n- [检查二进制字符串字段](src/string/check_if_binary_string_has_at_most_one_segment_of_ones.rs)  [字符串]\n\n  - LeetCode 1784. 检查二进制字符串字段 \u003chttps://leetcode.cn/problems/check-if-binary-string-has-at-most-one-segment-of-ones\u003e\n\n- [重新格式化电话号码](src/string/reformat_phone_number.rs)  [字符串]\n\n  - LeetCode 1694. 重新格式化电话号码 \u003chttps://leetcode.cn/problems/reformat-phone-number\u003e\n\n- [字符串轮转](src/string/string_rotation_lcci.rs)  [字符串, 字符串匹配]\n\n  - LeetCode 面试题 01.09. 字符串轮转 \u003chttps://leetcode.cn/problems/string-rotation-lcci\u003e\n\n- [检查单词是否为句中其他单词的前缀](src/string/check_if_a_word_occurs_as_a_prefix_of_any_word_in_a_sentence.rs)  [字符串, 字符串匹配]\n\n  - LeetCode 1455. 检查单词是否为句中其他单词的前缀 \u003chttps://leetcode.cn/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence\u003e\n\n- [重新格式化字符串](src/string/reformat_the_string.rs)  [字符串]\n\n  - LeetCode 1417. 重新格式化字符串 \u003chttps://leetcode.cn/problems/reformat-the-string\u003e\n\n### 数组/队列/集合/映射\n\n- [使循环数组所有元素相等的最少秒数](src/array/minimum_seconds_to_equalize_a_circular_array.rs)  [数组, 哈希表]\n\n  - LeetCode 2808. 使循环数组所有元素相等的最少秒数 \u003chttps://leetcode.cn/problems/minimum-seconds-to-equalize-a-circular-array\u003e\n\n- [最长交替子数组](src/array/longest_alternating_subarray.rs)  [数组, 枚举]\n\n  - LeetCode 2765. 最长交替子数组 \u003chttps://leetcode.cn/problems/longest-alternating-subarray\u003e\n\n- [分割数组的最大值](src/array/split_array_largest_sum.rs)  [贪心, 数组, 二分查找, 动态规划, 前缀和]\n\n  - LeetCode 410. 分割数组的最大值 \u003chttps://leetcode.cn/problems/split-array-largest-sum\u003e\n\n- [按分隔符拆分字符串](src/array/split_strings_by_separator.rs)  [数组, 字符串]\n\n  - LeetCode 2788. 按分隔符拆分字符串 \u003chttps://leetcode.cn/problems/split-strings-by-separator\u003e\n\n- [最大字符串配对数目](src/array/find_maximum_number_of_string_pairs.rs)  [数组, 哈希表, 字符串, 模拟]\n\n  - LeetCode 2744. 最大字符串配对数目 \u003chttps://leetcode.cn/problems/find-maximum-number-of-string-pairs\u003e\n\n- [统计出现过一次的公共字符串](src/array/count_common_words_with_one_occurrence.rs)  [数组, 哈希表, 字符串, 计数]\n\n  - LeetCode 2085. 统计出现过一次的公共字符串 \u003chttps://leetcode.cn/problems/count-common-words-with-one-occurrence\u003e\n\n- [回旋镖的数量](src/array/number_of_boomerangs.rs)  [数组, 哈希表, 数学]\n\n  - LeetCode 447. 回旋镖的数量 \u003chttps://leetcode.cn/problems/number-of-boomerangs\u003e\n\n- [经营摩天轮的最大利润](src/array/maximum_profit_of_operating_a_centennial_wheel.rs)  [数组, 模拟]\n\n  - LeetCode 1599. 经营摩天轮的最大利润 \u003chttps://leetcode.cn/problems/maximum-profit-of-operating-a-centennial-wheel\u003e\n\n- [使用最小花费爬楼梯](src/array/min_cost_climbing_stairs.rs)  [数组, 动态规划]\n\n  - LeetCode 746. 使用最小花费爬楼梯 \u003chttps://leetcode.cn/problems/min-cost-climbing-stairs\u003e\n\n- [用邮票贴满网格图](src/array/stamping_the_grid.rs)  [贪心, 数组, 矩阵, 前缀和]\n\n  - LeetCode 2132. 用邮票贴满网格图 \u003chttps://leetcode.cn/problems/stamping-the-grid\u003e\n\n- [打家劫舍](src/array/house_robber.rs)  [数组, 动态规划]\n\n  - LeetCode 198. 打家劫舍 \u003chttps://leetcode.cn/problems/house-robber\u003e\n\n- [二进制字符串前缀一致的次数](src/array/number_of_times_binary_string_is_prefix_aligned.rs)  [数组]\n\n  - LeetCode 1375. 二进制字符串前缀一致的次数 \u003chttps://leetcode.cn/problems/number-of-times-binary-string-is-prefix-aligned\u003e\n\n- [数组中不等三元组的数目](src/array/number_of_unequal_triplets_in_array.rs)  [数组, 哈希表]\n\n  - LeetCode 2475. 数组中不等三元组的数目 \u003chttps://leetcode.cn/problems/number-of-unequal-triplets-in-array\u003e\n\n- [相等行列对](src/array/equal_row_and_column_pairs.rs)  [数组, 哈希表, 矩阵, 模拟]\n\n  - LeetCode 2352. 相等行列对 \u003chttps://leetcode.cn/problems/equal-row-and-column-pairs\u003e\n\n- [对数组执行操作](src/array/apply_operations_to_an_array.rs)  [数组, 模拟]\n\n  - LeetCode 2460. 对数组执行操作 \u003chttps://leetcode.cn/problems/apply-operations-to-an-array\u003e\n\n- [统计范围内的元音字符串数](src/array/count_vowel_strings_in_ranges.rs)  [数组, 字符串, 前缀和]\n\n  - LeetCode 2559. 统计范围内的元音字符串数 \u003chttps://leetcode.cn/problems/count-vowel-strings-in-ranges\u003e\n\n- [可被三整除的偶数的平均值](src/array/average_value_of_even_numbers_that_are_divisible_by_three.rs)  [数组, 数学]\n\n  - LeetCode 2455. 可被三整除的偶数的平均值 \u003chttps://leetcode.cn/problems/average-value-of-even-numbers-that-are-divisible-by-three\u003e\n\n- [有序矩阵中的第 k 个最小数组和](src/array/find_the_kth_smallest_sum_of_a_matrix_with_sorted_rows.rs)  [数组, 二分查找, 矩阵, 堆（优先队列）]\n\n  - LeetCode 1439. 有序矩阵中的第 k 个最小数组和 \u003chttps://leetcode.cn/problems/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows\u003e\n\n- [大样本统计](src/array/statistics_from_a_large_sample.rs)  [数组, 数学, 概率与统计]\n\n  - LeetCode 1093. 大样本统计 \u003chttps://leetcode.cn/problems/statistics-from-a-large-sample\u003e\n\n- [差值数组不同的字符串](src/array/odd_string_difference.rs)  [数组, 哈希表, 字符串]\n\n  - LeetCode 2451. 差值数组不同的字符串 \u003chttps://leetcode.cn/problems/odd-string-difference\u003e\n\n- [蓄水](src/array/store_water.rs)  [贪心, 数组, 堆（优先队列）]\n\n  - LeetCode LCP 33. 蓄水 \u003chttps://leetcode.cn/problems/o8SXZn\u003e\n\n- [负二进制数相加](src/array/adding_two_negabinary_numbers.rs)  [数组, 数学]\n\n  - LeetCode 1073. 负二进制数相加 \u003chttps://leetcode.cn/problems/adding-two-negabinary-numbers\u003e\n\n- [判断两个事件是否存在冲突](src/array/determine_if_two_events_have_conflict.rs)  [数组, 字符串]\n\n  - LeetCode 2446. 判断两个事件是否存在冲突 \u003chttps://leetcode.cn/problems/determine-if-two-events-have-conflict\u003e\n\n- [工作计划的最低难度](src/array/minimum_difficulty_of_a_job_schedule.rs)  [数组, 动态规划]\n\n  - LeetCode 1335. 工作计划的最低难度 \u003chttps://leetcode.cn/problems/minimum-difficulty-of-a-job-schedule\u003e\n\n- [按列翻转得到最大值等行数](src/array/flip_columns_for_maximum_number_of_equal_rows.rs)  [数组, 哈希表, 矩阵]\n\n  - LeetCode 1072. 按列翻转得到最大值等行数 \u003chttps://leetcode.cn/problems/flip-columns-for-maximum-number-of-equal-rows\u003e\n\n- [翻转子数组得到最大的数组值](src/array/reverse_subarray_to_maximize_array_value.rs)  [贪心, 数组, 数学]\n\n  - LeetCode 1330. 翻转子数组得到最大的数组值 \u003chttps://leetcode.cn/problems/reverse-subarray-to-maximize-array-value\u003e\n\n- [总持续时间可被 60 整除的歌曲](src/array/pairs_of_songs_with_total_durations_divisible_by_60.rs)  [数组, 哈希表, 计数]\n\n  - LeetCode 1010. 总持续时间可被 60 整除的歌曲 \u003chttps://leetcode.cn/problems/pairs-of-songs-with-total-durations-divisible-by-60\u003e\n\n- [处理用时最长的那个任务的员工](src/array/the_employee_that_worked_on_the_longest_task.rs)  [数组]\n\n  - LeetCode 2432. 处理用时最长的那个任务的员工 \u003chttps://leetcode.cn/problems/the-employee-that-worked-on-the-longest-task\u003e\n\n- [摘水果](src/array/maximum_fruits_harvested_after_at_most_k_steps.rs)  [数组, 二分查找, 前缀和, 滑动窗口]\n\n  - LeetCode 2106. 摘水果 \u003chttps://leetcode.cn/problems/maximum-fruits-harvested-after-at-most-k-steps\u003e\n\n- [最长字符串链](src/array/longest_string_chain.rs)  [数组, 哈希表, 双指针, 字符串, 动态规划]\n\n  - LeetCode 1048. 最长字符串链 \u003chttps://leetcode.cn/problems/longest-string-chain\u003e\n\n- [两个非重叠子数组的最大和](src/array/maximum_sum_of_two_non_overlapping_subarrays.rs)  [数组, 动态规划, 滑动窗口]\n\n  - LeetCode 1031. 两个非重叠子数组的最大和 \u003chttps://leetcode.cn/problems/maximum-sum-of-two-non-overlapping-subarrays\u003e\n\n- [填充书架](src/array/filling_bookcase_shelves.rs)  [数组, 动态规划]\n\n  - LeetCode 1105. 填充书架 \u003chttps://leetcode.cn/problems/filling-bookcase-shelves\u003e\n\n- [最长等差数列](src/array/longest_arithmetic_subsequence.rs)  [数组, 哈希表, 二分查找, 动态规划]\n\n  - LeetCode 1027. 最长等差数列 \u003chttps://leetcode.cn/problems/longest-arithmetic-subsequence\u003e\n\n- [分隔数组以得到最大和](src/array/partition_array_for_maximum_sum.rs)  [数组, 动态规划]\n\n  - LeetCode 1043. 分隔数组以得到最大和 \u003chttps://leetcode.cn/problems/partition-array-for-maximum-sum\u003e\n\n- [子数组中占绝大多数的元素](src/array/online_majority_element_in_subarray.rs)  [设计, 树状数组, 线段树, 数组, 二分查找]\n\n  - LeetCode 1157. 子数组中占绝大多数的元素 \u003chttps://leetcode.cn/problems/online-majority-element-in-subarray\u003e\n\n- [出现最频繁的偶数元素](src/array/most_frequent_even_element.rs)  [数组, 哈希表, 计数]\n\n  - LeetCode 2404. 出现最频繁的偶数元素 \u003chttps://leetcode.cn/problems/most-frequent-even-element\u003e\n\n- [检查相同字母间的距离](src/array/check_distances_between_same_letters.rs)  [数组, 哈希表, 字符串]\n\n  - LeetCode 2399. 检查相同字母间的距离 \u003chttps://leetcode.cn/problems/check-distances-between-same-letters\u003e\n\n- [合并石头的最低成本](src/array/minimum_cost_to_merge_stones.rs)  [数组, 动态规划]\n\n  - LeetCode 1000. 合并石头的最低成本 \u003chttps://leetcode.cn/problems/minimum-cost-to-merge-stones\u003e\n\n- [交换一次的先前排列](src/array/previous_permutation_with_one_swap.rs)  [贪心, 数组]\n\n  - LeetCode 1053. 交换一次的先前排列 \u003chttps://leetcode.cn/problems/previous-permutation-with-one-swap\u003e\n\n- [多边形三角剖分的最低得分](src/array/minimum_score_triangulation_of_polygon.rs)  [数组, 动态规划]\n\n  - LeetCode 1039. 多边形三角剖分的最低得分 \u003chttps://leetcode.cn/problems/minimum-score-triangulation-of-polygon\u003e\n\n- [算术三元组的数目](src/array/number_of_arithmetic_triplets.rs)  [数组, 哈希表, 双指针, 枚举]\n\n  - LeetCode 2367. 算术三元组的数目 \u003chttps://leetcode.cn/problems/number-of-arithmetic-triplets\u003e\n\n- [和相等的子数组](src/array/find_subarrays_with_equal_sum.rs)  [数组, 哈希表]\n\n  - LeetCode 2395. 和相等的子数组 \u003chttps://leetcode.cn/problems/find-subarrays-with-equal-sum\u003e\n\n- [和等于 k 的最长子数组长度](src/array/maximum_size_subarray_sum_equals_k.rs)  [数组, 哈希表]\n\n  - LeetCode 325. 和等于 k 的最长子数组长度 \u003chttps://leetcode.cn/problems/maximum-size-subarray-sum-equals-k/\u003e\n\n- [提莫攻击](src/array/teemo_attacking.rs)  [数组, 模拟]\n\n  - LeetCode 495. 提莫攻击 \u003chttps://leetcode.cn/problems/teemo-attacking/\u003e\n\n- [单调数列](src/array/monotonic_array.rs)  [数组]\n\n  - LeetCode 896. 单调数列 \u003chttps://leetcode.cn/problems/monotonic-array/\u003e\n\n- [统计好三元组](src/array/count_good_triplets.rs)  [数组, 枚举]\n\n  - LeetCode 1534. 统计好三元组 \u003chttps://leetcode.cn/problems/count-good-triplets/\u003e\n\n- [翻转对](src/array/reverse_pairs.rs)  [树状数组, 线段树, 数组, 二分查找, 分治, 有序集合, 归并排序]\n\n  - LeetCode 493. 翻转对 \u003chttps://leetcode.cn/problems/reverse-pairs/\u003e\n\n- [合并区间](src/array/merge_intervals.rs)  [数组, 排序]\n\n  - LeetCode 56. 合并区间 \u003chttps://leetcode.cn/problems/merge-intervals/\u003e\n\n- [零矩阵](src/array/zero_matrix_lcci.rs)  [数组, 哈希表, 矩阵]\n\n  - LeetCode 面试题 01.08. 零矩阵 \u003chttps://leetcode.cn/problems/zero-matrix-lcci\u003e\n\n- [数组中的第K个最大元素](src/array/kth_largest_element_in_an_array.rs)  [数组, 分治, 快速选择, 排序, 堆（优先队列）]\n\n  - LeetCode 215. 数组中的第K个最大元素 \u003chttps://leetcode.cn/problems/kth-largest-element-in-an-array/\u003e\n\n- [数组的相对排序](src/array/relative_sort_array.rs)  [数组, 哈希表, 计数排序, 排序]\n\n  - LeetCode 1122. 数组的相对排序 \u003chttps://leetcode.cn/problems/relative-sort-array/\u003e\n\n- [二进制矩阵中的特殊位置](src/array/special_positions_in_a_binary_matrix.rs)  [数组, 矩阵]\n\n  - LeetCode 1582. 二进制矩阵中的特殊位置 \u003chttps://leetcode.cn/problems/special-positions-in-a-binary-matrix\u003e\n\n- [无重叠区间](src/array/non_overlapping_intervals.rs)  [贪心, 数组, 动态规划, 排序]\n\n  - LeetCode 435. 无重叠区间 \u003chttps://leetcode.cn/problems/non-overlapping-intervals/\u003e\n\n- [最长数对链](src/array/maximum_length_of_pair_chain.rs)  [贪心, 数组, 动态规划, 排序]\n\n  - LeetCode 646. 最长数对链 \u003chttps://leetcode.cn/problems/maximum-length-of-pair-chain\u003e\n\n- [字母异位词分组](src/array/group_anagrams.rs)  [数组, 哈希表, 字符串, 排序]\n\n  - LeetCode 49. 字母异位词分组 \u003chttps://leetcode.cn/problems/group-anagrams\u003e\n\n- [滑动窗口最大值](src/array/sliding_window_maximum.rs)  [队列, 数组, 滑动窗口, 单调队列, 堆（优先队列）]\n\n  - LeetCode 239. 滑动窗口最大值 \u003chttps://leetcode.cn/problems/sliding-window-maximum\u003e\n\n- [两数之和](src/array/two_sum.rs)  [数组, 哈希表]\n\n  - LeetCode 1. 两数之和 \u003chttps://leetcode.cn/problems/two-sum\u003e\n\n- [重新排列数组](src/array/shuffle_the_array.rs)  [数组]\n\n  - LeetCode 1470. 重新排列数组 \u003chttps://leetcode.cn/problems/shuffle-the-array/\u003e\n\n- [删除有序数组中的重复项](src/array/remove_duplicates_from_sorted_array.rs)  [数组, 双指针]\n\n  - LeetCode 26. 删除有序数组中的重复项 \u003chttps://leetcode.cn/problems/remove-duplicates-from-sorted-array/\u003e\n\n- [加一](src/array/plus_one.rs)  [数组, 数学]\n\n  - LeetCode 66. 加一 \u003chttps://leetcode.cn/problems/plus-one/\u003e\n\n- [移动零](src/array/move_zeroes.rs)  [数组, 双指针]\n\n  - LeetCode 283. 移动零 \u003chttps://leetcode.cn/problems/move-zeroes/\u003e\n\n- [通过翻转子数组使两个数组相等](src/array/make_two_arrays_equal_by_reversing_sub_arrays.rs)  [数组, 哈希表, 排序]\n\n  - LeetCode 1460. 通过翻转子数组使两个数组相等 \u003chttps://leetcode.cn/problems/make-two-arrays-equal-by-reversing-sub-arrays\u003e\n\n### 栈\n\n- [构造有效字符串的最少插入数](src/stack/minimum_additions_to_make_valid_string.rs)  [栈, 贪心, 字符串, 动态规划]\n\n  - LeetCode 2645. 构造有效字符串的最少插入数 \u003chttps://leetcode.cn/problems/minimum-additions-to-make-valid-string\u003e\n\n- [删除子串后的字符串最小长度](src/stack/minimum_string_length_after_removing_substrings.rs)  [栈, 字符串, 模拟]\n\n  - LeetCode 2696. 删除子串后的字符串最小长度 \u003chttps://leetcode.cn/problems/minimum-string-length-after-removing-substrings\u003e\n\n- [队列中可以看到的人数](src/stack/number_of_visible_people_in_a_queue.rs)  [栈, 数组, 单调栈]\n\n  - LeetCode 1944. 队列中可以看到的人数 \u003chttps://leetcode.cn/problems/number-of-visible-people-in-a-queue\u003e\n\n- [从链表中移除节点](src/stack/remove_nodes_from_linked_list.rs)  [栈, 递归, 链表, 单调栈]\n\n  - LeetCode 2487. 从链表中移除节点 \u003chttps://leetcode.cn/problems/remove-nodes-from-linked-list\u003e\n\n- [叶值的最小代价生成树](src/stack/minimum_cost_tree_from_leaf_values.rs)  [栈, 贪心, 数组, 动态规划, 单调栈]\n\n  - LeetCode 1130. 叶值的最小代价生成树 \u003chttps://leetcode.cn/problems/minimum-cost-tree-from-leaf-values\u003e\n\n- [检查替换后的词是否有效](src/stack/check_if_word_is_valid_after_substitutions.rs)  [栈, 字符串]\n\n  - LeetCode 1003. 检查替换后的词是否有效 \u003chttps://leetcode.cn/problems/check-if-word-is-valid-after-substitutions\u003e\n\n- [餐盘栈](src/stack/dinner_plate_stacks.rs)  [栈, 设计, 哈希表, 堆（优先队列）]\n\n  - LeetCode 1172. 餐盘栈 \u003chttps://leetcode.cn/problems/dinner-plate-stacks\u003e\n\n- [链表中的下一个更大节点](src/stack/next_greater_node_in_linked_list.rs)  [栈, 数组, 链表, 单调栈]\n\n  - LeetCode 1019. 链表中的下一个更大节点 \u003chttps://leetcode.cn/problems/next-greater-node-in-linked-list\u003e\n\n- [删除最短的子数组使剩余数组有序](src/stack/shortest_subarray_to_be_removed_to_make_array_sorted.rs)  [栈, 数组, 双指针, 二分查找, 单调栈]\n\n  - LeetCode 1574. 删除最短的子数组使剩余数组有序 \u003chttps://leetcode.cn/problems/shortest-subarray-to-be-removed-to-make-array-sorted\u003e\n\n- [使括号有效的最少添加](src/stack/minimum_add_to_make_parentheses_valid.rs)  [栈, 贪心, 字符串]\n\n  - LeetCode 921. 使括号有效的最少添加 \u003chttps://leetcode.cn/problems/minimum-add-to-make-parentheses-valid\u003e\n\n- [文件夹操作日志搜集器](src/stack/crawler_log_folder.rs)  [栈, 数组, 字符串]\n\n  - LeetCode 1598. 文件夹操作日志搜集器 \u003chttps://leetcode.cn/problems/crawler-log-folder\u003e\n\n- [最小栈](src/stack/min_stack.rs)  [栈, 设计]\n\n  - LeetCode 155. 最小栈 \u003chttps://leetcode.cn/problems/min-stack/\u003e\n\n- [有效的括号](src/stack/valid_parentheses.rs)  [栈, 字符串]\n\n  - LeetCode 20. 有效的括号 \u003chttps://leetcode.cn/problems/valid-parentheses/\u003e\n\n- [验证栈序列](src/stack/validate_stack_sequences.rs)  [栈, 数组, 模拟]\n\n  - LeetCode 946. 验证栈序列 \u003chttps://leetcode.cn/problems/validate-stack-sequences\u003e\n\n- [商品折扣后的最终价格](src/stack/final_prices_with_a_special_discount_in_a_shop.rs)  [栈, 数组, 单调栈]\n\n  - LeetCode 1475. 商品折扣后的最终价格 \u003chttps://leetcode.cn/problems/final-prices-with-a-special-discount-in-a-shop\u003e\n\n### 树\n\n- [字符串中的额外字符](src/tree/extra_characters_in_a_string.rs)  [字典树, 数组, 哈希表, 字符串, 动态规划]\n\n  - LeetCode 2707. 字符串中的额外字符 \u003chttps://leetcode.cn/problems/extra-characters-in-a-string\u003e\n\n- [从二叉搜索树到更大和树](src/tree/binary_search_tree_to_greater_sum_tree.rs)  [树, 深度优先搜索, 二叉搜索树, 二叉树]\n\n  - LeetCode 1038. 从二叉搜索树到更大和树 \u003chttps://leetcode.cn/problems/binary-search-tree-to-greater-sum-tree\u003e\n\n- [树节点的第 K 个祖先](src/tree/kth_ancestor_of_a_tree_node.rs)  [树, 深度优先搜索, 广度优先搜索, 设计, 二分查找, 动态规划]\n\n  - LeetCode 1483. 树节点的第 K 个祖先 \u003chttps://leetcode.cn/problems/kth-ancestor-of-a-tree-node\u003e\n\n- [删点成林](src/tree/delete_nodes_and_return_forest.rs)  [树, 深度优先搜索, 数组, 哈希表, 二叉树]\n\n  - LeetCode 1110. 删点成林 \u003chttps://leetcode.cn/problems/delete-nodes-and-return-forest\u003e\n\n- [根到叶路径上的不足节点](src/tree/insufficient_nodes_in_root_to_leaf_paths.rs)  [树, 深度优先搜索, 二叉树]\n\n  - LeetCode 1080. 根到叶路径上的不足节点 \u003chttps://leetcode.cn/problems/insufficient-nodes-in-root-to-leaf-paths\u003e\n\n- [二叉搜索子树的最大键值和](src/tree/maximum_sum_bst_in_binary_tree.rs)  [树, 深度优先搜索, 二叉搜索树, 动态规划, 二叉树]\n\n  - LeetCode 1373. 二叉搜索子树的最大键值和 \u003chttps://leetcode.cn/problems/maximum-sum-bst-in-binary-tree\u003e\n\n- [通知所有员工所需的时间](src/tree/time_needed_to_inform_all_employees.rs)  [树, 深度优先搜索, 广度优先搜索]\n\n  - LeetCode 1376. 通知所有员工所需的时间 \u003chttps://leetcode.cn/problems/time-needed-to-inform-all-employees\u003e\n\n- [节点与其祖先之间的最大差值](src/tree/maximum_difference_between_node_and_ancestor.rs)  [树, 深度优先搜索, 二叉树]\n\n  - LeetCode 1026. 节点与其祖先之间的最大差值 \u003chttps://leetcode.cn/problems/maximum-difference-between-node-and-ancestor\u003e\n\n- [驼峰式匹配](src/tree/camelcase_matching.rs)  [字典树, 双指针, 字符串, 字符串匹配]\n\n  - LeetCode 1023. 驼峰式匹配 \u003chttps://leetcode.cn/problems/camelcase-matching\u003e\n\n- [二叉搜索树中的插入操作](src/tree/insert_into_a_binary_search_tree.rs)  [树, 二叉搜索树, 二叉树]\n\n  - LeetCode 701. 二叉搜索树中的插入操作 \u003chttps://leetcode.cn/problems/insert-into-a-binary-search-tree\u003e\n\n- [二叉树的前序遍历](src/tree/binary_tree_preorder_traversal.rs)  [栈, 树, 深度优先搜索, 二叉树]\n\n  - LeetCode 144. 二叉树的前序遍历 \u003chttps://leetcode.cn/problems/binary-tree-preorder-traversal/\u003e\n\n- [二叉树的中序遍历](src/tree/binary_tree_inorder_traversal.rs)  [栈, 树, 深度优先搜索, 二叉树]\n\n  - LeetCode 94. 二叉树的中序遍历 \u003chttps://leetcode.cn/problems/binary-tree-inorder-traversal\u003e\n\n- [二叉树的后序遍历](src/tree/binary_tree_postorder_traversal.rs)  [栈, 树, 深度优先搜索, 二叉树]\n\n  - LeetCode 145. 二叉树的后序遍历 \u003chttps://leetcode.cn/problems/binary-tree-postorder-traversal\u003e\n\n- [二叉树的层序遍历](src/tree/binary_tree_level_order_traversal.rs)  [树, 广度优先搜索, 二叉树]\n\n  - LeetCode 102. 二叉树的层序遍历 \u003chttps://leetcode.cn/problems/binary-tree-level-order-traversal\u003e\n\n- [最长同值路径](src/tree/longest_univalue_path.rs)  [树, 深度优先搜索, 二叉树]\n\n  - LeetCode 687. 最长同值路径 \u003chttps://leetcode.cn/problems/longest-univalue-path\u003e\n\n### 链表\n\n- [删除排序链表中的重复元素 II](src/list/remove_duplicates_from_sorted_list_ii.rs)  [链表, 双指针]\n\n  - LeetCode 82. 删除排序链表中的重复元素 II \u003chttps://leetcode.cn/problems/remove-duplicates-from-sorted-list-ii\u003e\n\n- [在链表中插入最大公约数](src/list/insert_greatest_common_divisors_in_linked_list.rs)  [链表, 数学, 数论]\n\n  - LeetCode 2807. 在链表中插入最大公约数 \u003chttps://leetcode.cn/problems/insert-greatest-common-divisors-in-linked-list\u003e\n\n- [从链表中删去总和值为零的连续节点](src/list/remove_zero_sum_consecutive_nodes_from_linked_list.rs)  [哈希表, 链表]\n\n  - LeetCode 1171. 从链表中删去总和值为零的连续节点 \u003chttps://leetcode.cn/problems/remove-zero-sum-consecutive-nodes-from-linked-list\u003e\n\n- [删除链表的倒数第 N 个结点](src/list/remove_nth_node_from_end_of_list.rs)  [链表, 双指针]\n\n  - LeetCode 19. 删除链表的倒数第 N 个结点 \u003chttps://leetcode.cn/problems/remove-nth-node-from-end-of-list/\u003e\n\n- [链表的中间结点](src/list/middle_of_the_linked_list.rs)  [链表, 双指针]\n\n  - LeetCode 876. 链表的中间结点 \u003chttps://leetcode.cn/problems/middle-of-the-linked-list/\u003e\n\n### 图\n\n- [重新规划路线](src/graphs/reorder_routes_to_make_all_paths_lead_to_the_city_zero.rs)  [深度优先搜索, 广度优先搜索, 图]\n\n  - LeetCode 1466. 重新规划路线 \u003chttps://leetcode.cn/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero\u003e\n\n- [最小化旅行的价格总和](src/graphs/minimize_the_total_price_of_the_trips.rs)  [树, 深度优先搜索, 图, 数组, 动态规划]\n\n  - LeetCode 2646. 最小化旅行的价格总和 \u003chttps://leetcode.cn/problems/minimize-the-total-price-of-the-trips\u003e\n\n- [到达首都的最少油耗](src/graphs/minimum_fuel_cost_to_report_to_the_capital.rs)  [树, 深度优先搜索, 广度优先搜索, 图]\n\n  - LeetCode 2477. 到达首都的最少油耗 \u003chttps://leetcode.cn/problems/minimum-fuel-cost-to-report-to-the-capital\u003e\n\n- [T 秒后青蛙的位置](src/graphs/frog_position_after_t_seconds.rs)  [树, 深度优先搜索, 广度优先搜索, 图]\n\n  - LeetCode 1377. T 秒后青蛙的位置 \u003chttps://leetcode.cn/problems/frog-position-after-t-seconds\u003e\n\n- [不邻接植花](src/graphs/flower_planting_with_no_adjacent.rs)  [深度优先搜索, 广度优先搜索, 图]\n\n  - LeetCode 1042. 不邻接植花 \u003chttps://leetcode.cn/problems/flower-planting-with-no-adjacent\u003e\n\n- [找到小镇的法官](src/graphs/find_the_town_judge.rs)  [图, 数组, 哈希表]\n\n  - LeetCode 997. 找到小镇的法官 \u003chttps://leetcode.cn/problems/find-the-town-judge\u003e\n\n### 排序\n\n- [拿出最少数目的魔法豆](src/sort/removing_minimum_number_of_magic_beans.rs)  [数组, 前缀和, 排序]\n\n  - LeetCode 2171. 拿出最少数目的魔法豆 \u003chttps://leetcode.cn/problems/removing-minimum-number-of-magic-beans\u003e\n\n- [购买两块巧克力](src/sort/buy_two_chocolates.rs)  [数组, 排序]\n\n  - LeetCode 2706. 购买两块巧克力 \u003chttps://leetcode.cn/problems/buy-two-chocolates\u003e\n\n- [下一个更大元素 IV](src/sort/next_greater_element_iv.rs)  [栈, 数组, 二分查找, 排序, 单调栈, 堆（优先队列）]\n\n  - LeetCode 2454. 下一个更大元素 IV \u003chttps://leetcode.cn/problems/next-greater-element-iv\u003e\n\n- [出租车的最大盈利](src/sort/maximum_earnings_from_taxi.rs)  [数组, 二分查找, 动态规划, 排序]\n\n  - LeetCode 2008. 出租车的最大盈利 \u003chttps://leetcode.cn/problems/maximum-earnings-from-taxi\u003e\n\n- [可被三整除的最大和](src/sort/greatest_sum_divisible_by_three.rs)  [贪心, 数组, 动态规划, 排序]\n\n  - LeetCode 1262. 可被三整除的最大和 \u003chttps://leetcode.cn/problems/greatest-sum-divisible-by-three\u003e\n\n- [比较字符串最小字母出现频次](src/sort/compare_strings_by_frequency_of_the_smallest_character.rs)  [数组, 哈希表, 字符串, 二分查找, 排序]\n\n  - LeetCode 1170. 比较字符串最小字母出现频次 \u003chttps://leetcode.cn/problems/compare-strings-by-frequency-of-the-smallest-character\u003e\n\n- [老鼠和奶酪](src/sort/mice_and_cheese.rs)  [贪心, 数组, 排序, 堆（优先队列）]\n\n  - LeetCode 2611. 老鼠和奶酪 \u003chttps://leetcode.cn/problems/mice-and-cheese\u003e\n\n- [不同的平均值数目](src/sort/number_of_distinct_averages.rs)  [数组, 哈希表, 双指针, 排序]\n\n  - LeetCode 2465. 不同的平均值数目 \u003chttps://leetcode.cn/problems/number-of-distinct-averages\u003e\n\n- [礼盒的最大甜蜜度](src/sort/maximum_tastiness_of_candy_basket.rs)  [数组, 二分查找, 排序]\n\n  - LeetCode 2517. 礼盒的最大甜蜜度 \u003chttps://leetcode.cn/problems/maximum-tastiness-of-candy-basket\u003e\n\n- [受标签影响的最大值](src/sort/largest_values_from_labels.rs)  [贪心, 数组, 哈希表, 计数, 排序]\n\n  - LeetCode 1090. 受标签影响的最大值 \u003chttps://leetcode.cn/problems/largest-values-from-labels\u003e\n\n- [距离相等的条形码](src/sort/distant_barcodes.rs)  [贪心, 数组, 哈希表, 计数, 排序, 堆（优先队列）]\n\n  - LeetCode 1054. 距离相等的条形码 \u003chttps://leetcode.cn/problems/distant-barcodes\u003e\n\n- [与对应负数同时存在的最大正整数](src/sort/largest_positive_integer_that_exists_with_its_negative.rs)  [数组, 哈希表, 双指针, 排序]\n\n  - LeetCode 2441. 与对应负数同时存在的最大正整数 \u003chttps://leetcode.cn/problems/largest-positive-integer-that-exists-with-its-negative\u003e\n\n- [按身高排序](src/sort/sort_the_people.rs)  [数组, 哈希表, 字符串, 排序]\n\n  - LeetCode 2418. 按身高排序 \u003chttps://leetcode.cn/problems/sort-the-people\u003e\n\n- [使数组严格递增](src/sort/make_array_strictly_increasing.rs)  [数组, 二分查找, 动态规划, 排序]\n\n  - LeetCode 1187. 使数组严格递增 \u003chttps://leetcode.cn/problems/make-array-strictly-increasing\u003e\n\n- [移动石子直到连续 II](src/sort/moving_stones_until_consecutive_ii.rs)  [数组, 数学, 双指针, 排序]\n\n  - LeetCode 1040. 移动石子直到连续 II \u003chttps://leetcode.cn/problems/moving-stones-until-consecutive-ii\u003e\n\n- [两点之间不包含任何点的最宽垂直区域](src/sort/widest_vertical_area_between_two_points_containing_no_points.rs)  [数组, 排序]\n\n  - LeetCode 1637. 两点之间不包含任何点的最宽垂直区域 \u003chttps://leetcode.cn/problems/widest-vertical-area-between-two-points-containing-no-points\u003e\n\n- [排序数组](src/sort/sort_an_array.rs)  [数组, 分治, 桶排序, 计数排序, 基数排序, 排序, 堆（优先队列）, 归并排序]\n\n  - LeetCode 912. 排序数组 \u003chttps://leetcode.cn/problems/sort-an-array/\u003e\n\n- [合并两个有序链表](src/sort/merge_two_sorted_lists.rs)  [递归, 链表]\n\n  - LeetCode 21. 合并两个有序链表 \u003chttps://leetcode.cn/problems/merge-two-sorted-lists/\u003e\n\n- [反转链表](src/sort/reverse_linked_list.rs)  [递归, 链表]\n\n  - LeetCode 206. 反转链表 \u003chttps://leetcode.cn/problems/reverse-linked-list/\u003e\n\n### 其它\n\n- [自由之路](src/search/freedom_trail.rs)  [深度优先搜索, 广度优先搜索, 字符串, 动态规划]\n\n  - LeetCode 514. 自由之路 \u003chttps://leetcode.cn/problems/freedom-trail\u003e\n\n- [赎金信](src/map/ransom_note.rs)  [哈希表, 字符串, 计数]\n\n  - LeetCode 383. 赎金信 \u003chttps://leetcode.cn/problems/ransom-note\u003e\n\n- [最小体力消耗路径](src/search/path_with_minimum_effort.rs)  [深度优先搜索, 广度优先搜索, 并查集, 数组, 二分查找, 矩阵, 堆（优先队列）]\n\n  - LeetCode 1631. 最小体力消耗路径 \u003chttps://leetcode.cn/problems/path-with-minimum-effort\u003e\n\n- [爬楼梯](src/search/climbing_stairs.rs)  [记忆化搜索, 数学, 动态规划]\n\n  - LeetCode 70. 爬楼梯 \u003chttps://leetcode.cn/problems/climbing-stairs\u003e\n\n- [水域大小](src/search/pond_sizes_lcci.rs)  [深度优先搜索, 广度优先搜索, 并查集, 数组, 矩阵]\n\n  - LeetCode 面试题 16.19. 水域大小 \u003chttps://leetcode.cn/problems/pond-sizes-lcci\u003e\n\n- [黑白翻转棋](src/search/flip_chess.rs)  [广度优先搜索, 数组, 矩阵]\n\n  - LeetCode LCP 41. 黑白翻转棋 \u003chttps://leetcode.cn/problems/fHi6rV\u003e\n\n- [统计封闭岛屿的数目](src/search/number_of_closed_islands.rs)  [深度优先搜索, 广度优先搜索, 并查集, 数组, 矩阵]\n\n  - LeetCode 1254. 统计封闭岛屿的数目 \u003chttps://leetcode.cn/problems/number-of-closed-islands\u003e\n\n- [铺瓷砖](src/other/tiling_a_rectangle_with_the_fewest_squares.rs)  [动态规划, 回溯]\n\n  - LeetCode 1240. 铺瓷砖 \u003chttps://leetcode.cn/problems/tiling-a-rectangle-with-the-fewest-squares\u003e\n\n- [单字符重复子串的最大长度](src/map/swap_for_longest_repeated_character_substring.rs)  [哈希表, 字符串, 滑动窗口]\n\n  - LeetCode 1156. 单字符重复子串的最大长度 \u003chttps://leetcode.cn/problems/swap-for-longest-repeated-character-substring\u003e\n\n- [二进制矩阵中的最短路径](src/search/shortest_path_in_binary_matrix.rs)  [广度优先搜索, 数组, 矩阵]\n\n  - LeetCode 1091. 二进制矩阵中的最短路径 \u003chttps://leetcode.cn/problems/shortest-path-in-binary-matrix\u003e\n\n- [活字印刷](src/map/letter_tile_possibilities.rs)  [哈希表, 字符串, 回溯, 计数]\n\n  - LeetCode 1079. 活字印刷 \u003chttps://leetcode.cn/problems/letter-tile-possibilities\u003e\n\n- [可被 K 整除的最小整数](src/map/smallest_integer_divisible_by_k.rs)  [哈希表, 数学]\n\n  - LeetCode 1015. 可被 K 整除的最小整数 \u003chttps://leetcode.cn/problems/smallest-integer-divisible-by-k\u003e\n\n- [推箱子](src/search/minimum_moves_to_move_a_box_to_their_target_location.rs)  [广度优先搜索, 数组, 矩阵, 堆（优先队列）]\n\n  - LeetCode 1263. 推箱子 \u003chttps://leetcode.cn/problems/minimum-moves-to-move-a-box-to-their-target-location\u003e\n\n- [强整数](src/map/powerful_integers.rs)  [哈希表, 数学]\n\n  - LeetCode 970. 强整数 \u003chttps://leetcode.cn/problems/powerful-integers\u003e\n\n- [删除字符使频率相同](src/map/remove_letter_to_equalize_frequency.rs)  [哈希表, 字符串, 计数]\n\n  - LeetCode 2423. 删除字符使频率相同 \u003chttps://leetcode.cn/problems/remove-letter-to-equalize-frequency\u003e\n\n- [统计只差一个字符的子串数目](src/map/count_substrings_that_differ_by_one_character.rs)  [哈希表, 字符串, 动态规划]\n\n  - LeetCode 1638. 统计只差一个字符的子串数目 \u003chttps://leetcode.cn/problems/count-substrings-that-differ-by-one-character\u003e\n\n- [第 k 个数](src/map/get_kth_magic_number_lcci.rs)  [哈希表, 数学, 动态规划, 堆（优先队列）]\n\n  - LeetCode 面试题 17.09. 第 k 个数 \u003chttps://leetcode.cn/problems/get-kth-magic-number-lcci\u003e\n\n- [判定是否互为字符重排](src/map/check_permutation_lcci.rs)  [哈希表, 字符串, 排序]\n\n  - LeetCode 面试题 01.02. 判定是否互为字符重排 \u003chttps://leetcode.cn/problems/check-permutation-lcci\u003e\n\n- [有效的字母异位词](src/map/valid_anagram.rs)  [哈希表, 字符串, 排序]\n\n  - LeetCode 242. 有效的字母异位词 \u003chttps://leetcode.cn/problems/valid-anagram\u003e\n\n- [阶乘函数后 K 个零](src/math/preimage_size_of_factorial_zeroes_function.rs)  [数学, 二分查找]\n\n  - LeetCode 793. 阶乘函数后 K 个零 \u003chttps://leetcode.cn/problems/preimage-size-of-factorial-zeroes-function\u003e\n\n- [灯泡开关 Ⅱ](src/math/bulb_switcher_ii.rs)  [位运算, 深度优先搜索, 广度优先搜索, 数学]\n\n  - LeetCode 672. 灯泡开关 Ⅱ \u003chttps://leetcode.cn/problems/bulb-switcher-ii\u003e\n\n- [消失的两个数字](src/math/missing_two_lcci.rs)  [位运算, 数组, 哈希表]\n\n  - LeetCode 面试题 17.19. 消失的两个数字 \u003chttps://leetcode.cn/problems/missing-two-lcci\u003e\n\n- [统计字典序元音字符串的数目](src/math/count_sorted_vowel_strings.rs)  [数学, 动态规划, 组合数学]\n\n  - LeetCode 1641. 统计字典序元音字符串的数目 \u003chttps://leetcode.cn/problems/count-sorted-vowel-strings\u003e\n\n- [公因子的数目](src/math/number_of_common_factors.rs)  [数学, 枚举, 数论]\n\n  - LeetCode 2427. 公因子的数目 \u003chttps://leetcode.cn/problems/number-of-common-factors\u003e\n\n- [负二进制转换](src/math/convert_to_base_2.rs)  [数学]\n\n  - LeetCode 1017. 负二进制转换 \u003chttps://leetcode.cn/problems/convert-to-base-2\u003e\n\n- [最小的必要团队](src/math/smallest_sufficient_team.rs)  [位运算, 数组, 动态规划, 状态压缩]\n\n  - LeetCode 1125. 最小的必要团队 \u003chttps://leetcode.cn/problems/smallest-sufficient-team\u003e\n\n- [困于环中的机器人](src/math/robot_bounded_in_circle.rs)  [数学, 字符串, 模拟]\n\n  - LeetCode 1041. 困于环中的机器人 \u003chttps://leetcode.cn/problems/robot-bounded-in-circle\u003e\n\n- [统计共同度过的日子数](src/math/count_days_spent_together.rs)  [数学, 字符串]\n\n  - LeetCode 2409. 统计共同度过的日子数 \u003chttps://leetcode.cn/problems/count-days-spent-together\u003e\n\n- [最小偶倍数](src/math/smallest_even_multiple.rs)  [数学, 数论]\n\n  - LeetCode 2413. 最小偶倍数 \u003chttps://leetcode.cn/problems/smallest-even-multiple\u003e\n\n- [构建回文串检测](src/math/can_make_palindrome_from_substring.rs)  [位运算, 数组, 哈希表, 字符串, 前缀和]\n\n  - LeetCode 1177. 构建回文串检测 \u003chttps://leetcode.cn/problems/can-make-palindrome-from-substring\u003e\n\n- [分割圆的最少切割次数](src/math/minimum_cuts_to_divide_a_circle.rs)  [几何, 数学]\n\n  - LeetCode 2481. 分割圆的最少切割次数 \u003chttps://leetcode.cn/problems/minimum-cuts-to-divide-a-circle\u003e\n\n- [连通两组点的最小成本](src/math/minimum_cost_to_connect_two_groups_of_points.rs)  [位运算, 数组, 动态规划, 状态压缩, 矩阵]\n\n  - LeetCode 1595. 连通两组点的最小成本 \u003chttps://leetcode.cn/problems/minimum-cost-to-connect-two-groups-of-points\u003e\n\n- [最大化网格幸福感](src/math/maximize_grid_happiness.rs)  [位运算, 记忆化搜索, 动态规划, 状态压缩]\n\n  - LeetCode 1659. 最大化网格幸福感 \u003chttps://leetcode.cn/problems/maximize-grid-happiness\u003e\n\n- [圆和矩形是否有重叠](src/math/circle_and_rectangle_overlapping.rs)  [几何, 数学]\n\n  - LeetCode 1401. 圆和矩形是否有重叠 \u003chttps://leetcode.cn/problems/circle-and-rectangle-overlapping\u003e\n\n- [找出中枢整数](src/math/find_the_pivot_integer.rs)  [数学, 前缀和]\n\n  - LeetCode 2485. 找出中枢整数 \u003chttps://leetcode.cn/problems/find-the-pivot-integer\u003e\n\n- [下一个更大的数值平衡数](src/math/next_greater_numerically_balanced_number.rs)  [数学, 回溯, 枚举]\n\n  - LeetCode 2048. 下一个更大的数值平衡数 \u003chttps://leetcode.cn/problems/next-greater-numerically-balanced-number\u003e\n\n- [不浪费原料的汉堡制作方案](src/math/number_of_burgers_with_no_waste_of_ingredients.rs)  [数学]\n\n  - LeetCode 1276. 不浪费原料的汉堡制作方案 \u003chttps://leetcode.cn/problems/number-of-burgers-with-no-waste-of-ingredients\u003e\n\n- [参加考试的最大学生数](src/math/maximum_students_taking_exam.rs)  [位运算, 数组, 动态规划, 状态压缩, 矩阵]\n\n  - LeetCode 1349. 参加考试的最大学生数 \u003chttps://leetcode.cn/problems/maximum-students-taking-exam\u003e\n\n- [一周中的第几天](src/math/day_of_the_week.rs)  [数学]\n\n  - LeetCode 1185. 一周中的第几天 \u003chttps://leetcode.cn/problems/day-of-the-week\u003e\n\n- [被列覆盖的最多行数](src/math/maximum_rows_covered_by_columns.rs)  [位运算, 数组, 回溯, 枚举, 矩阵]\n\n  - LeetCode 2397. 被列覆盖的最多行数 \u003chttps://leetcode.cn/problems/maximum-rows-covered-by-columns\u003e\n\n- [统计整数数目](src/math/count_of_integers.rs)  [数学, 字符串, 动态规划]\n\n  - LeetCode 2719. 统计整数数目 \u003chttps://leetcode.cn/problems/count-of-integers\u003e\n\n- [最大交换](src/math/maximum_swap.rs)  [贪心, 数学]\n\n  - LeetCode 670. 最大交换 \u003chttps://leetcode.cn/problems/maximum-swap\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyi-ge%2Frust-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyi-ge%2Frust-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyi-ge%2Frust-practice/lists"}