forked from krahets/hello-algo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format C, C++, C#, Go, Java, Python, Rust code.
- Loading branch information
Showing
53 changed files
with
152 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
!*/ | ||
*.dSYM/ | ||
|
||
build/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_backtracking; | ||
namespace hello_algo.chapter_backtracking; | ||
|
||
public class subset_sum_i { | ||
/* 回溯算法:子集和 I */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_backtracking; | ||
namespace hello_algo.chapter_backtracking; | ||
|
||
public class subset_sum_i_naive { | ||
/* 回溯算法:子集和 I */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_backtracking; | ||
namespace hello_algo.chapter_backtracking; | ||
|
||
public class subset_sum_ii { | ||
/* 回溯算法:子集和 II */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_dynamic_programming; | ||
namespace hello_algo.chapter_dynamic_programming; | ||
|
||
public class climbing_stairs_backtrack { | ||
/* 回溯 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_dynamic_programming; | ||
namespace hello_algo.chapter_dynamic_programming; | ||
|
||
public class climbing_stairs_dfs { | ||
/* 搜索 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_dynamic_programming; | ||
namespace hello_algo.chapter_dynamic_programming; | ||
|
||
public class climbing_stairs_dp { | ||
/* 爬楼梯:动态规划 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,13 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_dynamic_programming; | ||
namespace hello_algo.chapter_dynamic_programming; | ||
|
||
public class min_path_sum { | ||
/* 最小路径和:暴力搜索 */ | ||
public int minPathSumDFS(int[][] grid, int i, int j) { | ||
// 若为左上角单元格,则终止搜索 | ||
if (i == 0 && j == 0){ | ||
if (i == 0 && j == 0) { | ||
return grid[0][0]; | ||
} | ||
// 若行列索引越界,则返回 +∞ 代价 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_hashing; | ||
namespace hello_algo.chapter_hashing; | ||
|
||
public class built_in_hash { | ||
[Test] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_hashing; | ||
namespace hello_algo.chapter_hashing; | ||
|
||
public class simple_hash { | ||
/* 加法哈希 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_heap; | ||
namespace hello_algo.chapter_heap; | ||
|
||
public class top_k { | ||
/* 基于堆查找数组中最大的 k 个元素 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: hpstory ([email protected]) | ||
*/ | ||
|
||
namespace hello_algo.chapter_sorting; | ||
namespace hello_algo.chapter_sorting; | ||
|
||
public class heap_sort { | ||
/* 堆的长度为 n ,从节点 i 开始,从顶至底堆化 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.