Skip to content

Commit fb13cfc

Browse files
committed
Modified README.md
1 parent 12668d2 commit fb13cfc

File tree

1 file changed

+10
-97
lines changed

1 file changed

+10
-97
lines changed

README.md

Lines changed: 10 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
1-
# algo-hub-java
1+
# algo-hub-java-cpp
22

3-
基于 `jdk21` + `maven3.9` + `junit5` + `jacoco` 的 leetcode + codeforces + atcoder + nowcoder 练习仓库。
3+
基于 `jdk21` + `junit5` + `jacoco` 的 leetcode + codeforces + atcoder + nowcoder + luogu 练习仓库。
44

5-
`@since` 2021.07.05
5+
`@since` 2021.07.05,Day 1413 (2025.05.17) 已收录:
66

7-
~~(拼搏百天,我要完成 300 道 leetcode 题!(Day87 (2021.09.29) 已完成 303 题)~~
8-
9-
~~(拼搏 300 天,我要完成 1000 道 leetcode 题!(Day269 (2022.03.30) 已完成 1001 题)~~
10-
11-
~~(Day545 (2022.12.31) 已完成 1665 题)~~
12-
13-
Day911 (2024.01.01) 已完成:
14-
15-
- leetcode: 2251 题
16-
- codeforces: 559 题
17-
- atcoder: 290 题
7+
- leetcode: 3195 题
8+
- codeforces: 1021 题
9+
- atcoder: 345 题
1810

1911
---
2012

21-
- `atcoder-*` 存放 atcoder 题目。
22-
- `codeforces-*` 存放 codeforces 题目。
2313
- `leetcode-n` 存放 `100 * (n - 1) + 1` ~ `100 * n` 的题目(如 `leetcode-19` 存放 `1801` ~ `1900` 的题目)。
24-
- `leetcode-core` 存放 leetcode 自定义对象。
2514
- `leetcode-extends` 存放 专场竞赛/OJ 题目
2615
- `leetcode-interview` 存放 《程序员面试金典》 题目。
2716
- `leetcode-lcp` 存放 力扣杯 题目。
2817
- `leetcode-offer` 存放 《剑指 Offer》 题目。
29-
- `nowcoder-*` 存放 牛客 题目。
3018
- `数据库` 题目存放于 [https://gitee.com/gdut_yy/leetcode-hub-mysql](https://gitee.com/gdut_yy/leetcode-hub-mysql)
3119

3220
## 环境信息
@@ -58,8 +46,6 @@ mvn clean verify -s settings.xml
5846
python countSolutions.py
5947
```
6048

61-
![](./README/ut-coverage-report-2023.png)
62-
6349
## UT、TDD
6450

6551
java 项目中常见的测试框架:
@@ -103,42 +89,10 @@ junit5 常用断言:
10389
2. 使用 Java 反射实现 UT 的题目:716、2227、2276、2286;
10490
3. 类中提供接口,UT 中需实现该接口:341、489、702、1095、1428、1533;
10591

106-
## 一些 Trick
107-
108-
```java
109-
// 数组 使用 Map<Integer, Integer> 统计每个数值出现的频次
110-
int[] nums = {4, 1, 2, 1, 2};
111-
Map<Integer, Integer> cntMap = new HashMap<>();
112-
for (int num : nums) {
113-
// Verbose
114-
if (!cntMap.containsKey(num)) {
115-
cntMap.put(num, 0);
116-
}
117-
cntMap.put(num, cntMap.get(num) + 1);
118-
// Obvious
119-
cntMap.put(num, cntMap.getOrDefault(num, 0) + 1);
120-
}
121-
```
122-
123-
```java
124-
// 有向图 使用 Map<Integer, List<Integer>> 建图
125-
int[][] edges = {{0, 1}, {0, 2}, {0, 3}, {1, 4}};
126-
Map<Integer, List<Integer>> adj = new HashMap<>();
127-
for (int[] edge : edges) {
128-
int u = edge[0];
129-
int v = edge[1];
130-
// Verbose
131-
if (!adj.containsKey(u)) {
132-
adj.put(u, new ArrayList<>());
133-
}
134-
adj.get(u).add(v);
135-
// Obvious
136-
adj.computeIfAbsent(u, key -> new ArrayList<>()).add(v);
137-
}
138-
```
139-
14092
## 常用算法模板
14193

94+
- [一个方法团灭 LeetCode 打家劫舍问题](https://gdut-yy.github.io/doc-gitblogs-hope/module_algo/dp/state-machine/)
95+
14296
### 打表
14397

14498
[预计算结果](https://support.leetcode-cn.com/hc/kb/article/1278066)
@@ -179,20 +133,6 @@ junit5 常用断言:
179133
- [283. 移动零](https://leetcode.cn/problems/move-zeroes/)
180134
- [876. 链表的中间结点](https://leetcode.cn/problems/middle-of-the-linked-list/)
181135

182-
### 买卖股票系列
183-
184-
- [121. 买卖股票的最佳时机](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock/solution/) 暴力解法、动态规划(Java)
185-
- [122. 买卖股票的最佳时机 II](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/) 暴力搜索、贪心算法、动态规划(Java)
186-
- [123. 买卖股票的最佳时机 III](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iii/) 动态规划(Java)
187-
- [188. 买卖股票的最佳时机 IV](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iv) 动态规划(「力扣」更新过用例,只有优化空间的版本可以 AC)
188-
- [309. 最佳买卖股票时机含冷冻期](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-with-cooldown) 动态规划(Java)
189-
- [714. 买卖股票的最佳时机含手续费](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-with-transaction-fee) 动态规划(Java)
190-
191-
### 打家劫舍系列
192-
193-
- [198. 打家劫舍](https://leetcode.cn/problems/house-robber/)
194-
- [213. 打家劫舍 II](https://leetcode.cn/problems/house-robber-ii/)
195-
196136
### 存在重复元素系列
197137

198138
- [217. 存在重复元素](https://leetcode.cn/problems/contains-duplicate/)
@@ -244,34 +184,6 @@ junit5 常用断言:
244184
- [111. 二叉树的最小深度](https://leetcode.cn/problems/minimum-depth-of-binary-tree/)
245185
- [637. 二叉树的层平均值](https://leetcode.cn/problems/average-of-levels-in-binary-tree/)
246186

247-
```java
248-
public List<List<Integer>> levelOrder(TreeNode root) {
249-
List<List<Integer>> resList = new ArrayList<>();
250-
if (root == null) {
251-
return resList;
252-
}
253-
Queue<TreeNode> queue = new LinkedList<>();
254-
queue.add(root);
255-
while (!queue.isEmpty()) {
256-
List<Integer> curLevel = new ArrayList<>();
257-
int size = queue.size();
258-
for (int i = 0; i < size; i++) {
259-
// 上下文已保证 cur 不为 null
260-
TreeNode cur = queue.remove();
261-
curLevel.add(cur.val);
262-
if (cur.left != null) {
263-
queue.add(cur.left);
264-
}
265-
if (cur.right != null) {
266-
queue.add(cur.right);
267-
}
268-
}
269-
resList.add(curLevel);
270-
}
271-
return resList;
272-
}
273-
```
274-
275187
二叉树序列化
276188

277189
- [297. 二叉树的序列化与反序列化](https://leetcode.cn/problems/serialize-and-deserialize-binary-tree/)
@@ -481,4 +393,5 @@ Hierholzer 算法
481393
- [宫水三叶の刷题日记](https://www.acoier.com/tags/)
482394
- [灵茶の试炼](https://docs.qq.com/sheet/DWGFoRGVZRmxNaXFz?tab=BB08J2)
483395

484-
(全文完)
396+
[![ning2ing](https://img.shields.io/badge/ning2ing-Guardian%202374-blue?style=for-the-badge)](https://leetcode.cn/u/ning2ing/)
397+
[![ning1ing](https://img.shields.io/badge/ning1ing-Expert%201626-blue?style=for-the-badge)](https://codeforces.com/profile/ning1ing)

0 commit comments

Comments
 (0)