这是我在 LeetCode 上的 rust 解题仓库,主要用于记录自己的解题思路和代码。
ID | 名称 | 分类 | 标签 | 难度 | 链接 | 路径 |
---|---|---|---|---|---|---|
4 | 寻找两个正序数组的中位数 | algorithms | array,binary-search,divide-and-conquer | Hard | 链接 | 源码 |
5 | 最长回文子串 | algorithms | string,dynamic-programming | Medium | 链接 | 源码 |
6 | Z 字形变换 | algorithms | string | Medium | 链接 | 源码 |
7 | 整数反转 | algorithms | math | Medium | 链接 | 源码 |
8 | 字符串转换整数 (atoi) | algorithms | string | Medium | 链接 | 源码 |
10 | 正则表达式匹配 | algorithms | string,dynamic-programming,backtracking | Hard | 链接 | 源码 |
11 | 盛最多水的容器 | algorithms | array,two-pointers | Medium | 链接 | 源码 |
12 | 整数转罗马数字 | algorithms | math,string | Medium | 链接 | 源码 |
14 | 最长公共前缀 | algorithms | string | Easy | 链接 | 源码 |
15 | 三数之和 | algorithms | array,two-pointers | Medium | 链接 | 源码 |
17 | 电话号码的字母组合 | algorithms | string,backtracking | Medium | 链接 | 源码 |
19 | 删除链表的倒数第 N 个结点 | algorithms | linked-list,two-pointers | Medium | 链接 | 源码 |
21 | 合并两个有序链表 | algorithms | linked-list | Easy | 链接 | 源码 |
22 | 括号生成 | algorithms | string,backtracking | Medium | 链接 | 源码 |
24 | 两两交换链表中的节点 | algorithms | linked-list | Medium | 链接 | 源码 |
26 | 删除有序数组中的重复项 | algorithms | array,two-pointers | Easy | 链接 | 源码 |
28 | 找出字符串中第一个匹配项的下标 | algorithms | string | Easy | 链接 | 源码 |
35 | 搜索插入位置 | algorithms | array,binary-search | Easy | 链接 | 源码 |
50 | Pow(x, n) | algorithms | math,recursion | Medium | 链接 | 源码 |
58 | 最后一个单词的长度 | algorithms | string | Easy | 链接 | 源码 |
61 | 旋转链表 | algorithms | linked-list,two-pointers | Medium | 链接 | 源码 |
73 | 矩阵置零 | algorithms | array | Medium | 链接 | 源码 |
74 | 搜索二维矩阵 | algorithms | array,binary-search,matrix | Medium | 链接 | 源码 |
76 | 最小覆盖子串 | algorithms | hash-table,two-pointers,string,sliding-window | Hard | 链接 | 源码 |
83 | 删除排序链表中的重复元素 | algorithms | linked-list | Easy | 链接 | 源码 |
239 | 滑动窗口最大值 | algorithms | heap,sliding-window | Hard | 链接 | 源码 |
2182 | 构造限制重复的字符串 | algorithms | string,greedy | Medium | 链接 | 源码 |
3175 | 找到连续赢 K 场比赛的第一位玩家 | algorithms | array | Medium | 链接 | 源码 |
3180 | 执行操作可获得的最大总奖励 I | algorithms | dynamic-programming | Medium | 链接 | 源码 |
3181 | 执行操作可获得的最大总奖励 II | algorithms | dynamic-programming | Hard | 链接 | 源码 |
3185 | 构成整天的下标对数目 II | algorithms | array | Medium | 链接 | 源码 |
- 使用魔改的vscode插件LeetCode modified
- 修改git pre-commit hook
#!/bin/sh
cargo fmt --all
cargo run --bin readme_gen
git add README.md
template修改:
使用magicwenli.vscode-leetcode-modified最新版会自动修改rust的预制模板。
手动修改vsc-leetcode-cli
vscode-insiders\data\extensions\magicwenli.vscode-leetcode-modified-0.18.4\node_modules\vsc-leetcode-cli\templates\detailed.tpl
, 给template加上一些额外的东西struct Solution;
fn main() {}
${comment.singleLine} @lc code=start
${code}
${comment.singleLine} @lc code=end
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test() {}
}
MIT