Skip to content

Commit 71a5a4e

Browse files
author
haolin3
committed
init english
1 parent c458bdc commit 71a5a4e

File tree

2,411 files changed

+43459
-38096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,411 files changed

+43459
-38096
lines changed

.DS_Store

2 KB
Binary file not shown.

README.md

Lines changed: 9 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,186 +1,21 @@
1-
# 和小浩学算法
1+
# Hi, Boy
22

3-
> 本项目于 2020.7.22 位于 github 日总榜第一!截图留念!(还没有助力的,右上角快来个 star )
3+
> On July 22, 2020, the project ranked first in GitHub daily list! Take a screenshot as a souvenir! (star in the upper right corner! Thank you)
44
55
> [![图片展示失败,点击查看](https://www.geekxh.com/mark.png)](https://www.geekxh.com/mark.png)
66
7-
## 简介
7+
Xiaohao algorithm is a graphic algorithm problem dictionary completed by me during the epidemic period! At present, it has completed 140 + high-frequency interview algorithm questions, with a total of 30W words. All of them are in the way of cartoon illustration, which is easy to understand and suitable for the primary and intermediate readers.
88

99
> [![图片展示失败,点击查看](https://www.geekxh.com/book.png)](https://www.geekxh.com/book.png)
1010
11-
小浩算法是我在疫情期间完成的一部图解算法题典!<b> 目前共完成 140+ 道高频面试算法题目,总计 30w 字,全部采用漫画图解的方式,简单易懂,适合初中级读者。</b>
11+
> If you are willing to help me translate, welcome to contact ~
1212
13-
## 如何使用
13+
# Related Topics
1414

15-
1、因为本教程完全免费,但现在被一些不良商家拿去卖钱,<b> 所以我需要你先帮我点一个 star </b>,助力原创,防止更多人上当受骗,也顺便支持我一下。
15+
1、my_book(No translation yet.....)
1616

17-
2、如果你想直接下载我的这本电子书,[点击这里就行](https://www.geekxh.com/0.0.%E5%AD%A6%E4%B9%A0%E9%A1%BB%E7%9F%A5/03.html?3pVd)
17+
2、code_100
1818

19-
3、如果你还想加入我们的<b>万人刷题群</b>,和我们一起交流,遇见更优秀的人。请下方扫码回复【进群】
19+
3、interview_100
2020

21-
> [![图片展示失败,点击查看](https://www.geekxh.com/code.png)](https://www.geekxh.com/code.png)
22-
23-
4、当然,也许你就想加我的私人微信: [个人名片](https://www.geekxh.com/contact.jpeg)
24-
25-
## 本项目除此之外,还包括(持续更新):
26-
27-
1、100 张超清思维导图
28-
29-
2、100 篇大厂面试面经
30-
31-
3、100 本清晰版电子书
32-
33-
## 内容展示
34-
35-
我这里截取了思维导图以及算法题解的内容图片,可以看一下效果:
36-
37-
导图目录:[点击查看](https://www.geekxh.com/daotu-1.png)
38-
39-
导图效果展示:[点击查看](https://www.geekxh.com/daotu-2.png)
40-
41-
电子书效果展示: [点击查看](https://www.geekxh.com/book.png)
42-
43-
网站效果:[点击查看](https://www.geekxh.com/demo.png)
44-
45-
## 获取全部内容方式(任选其一)
46-
47-
1、通过网站下载(推荐,网速快):[下载地址](https://www.geekxh.com/0.0.%E5%AD%A6%E4%B9%A0%E9%A1%BB%E7%9F%A5/03.html?3pVd)
48-
49-
2、直接通过 github clone 项目。(国内不推荐)
50-
51-
3、公众号扫码回复 999。(直接通过百度云下载)
52-
53-
## 题解目录
54-
55-
* [开始学习](http://www.geekxh.com)
56-
57-
* [阅读指南](http://www.geekxh.com/c99/hello.html)
58-
59-
* [1.数组]()
60-
* [01.两个数组的交集(350)](http://www.geekxh.com/1.0.数组系列/001.html)
61-
* [02.最长公共前缀(14)](http://www.geekxh.com/1.0.数组系列/002.html)
62-
* [03.买卖股票的最佳时机(122)](http://www.geekxh.com/1.0.数组系列/003.html)
63-
* [04.旋转数组(189)](http://www.geekxh.com/1.0.数组系列/004.html)
64-
* [05.原地删除(27)](http://www.geekxh.com/1.0.数组系列/005.html)
65-
* [06.加一(66)](http://www.geekxh.com/1.0.数组系列/006.html)
66-
* [07.两数之和(1)](http://www.geekxh.com/1.0.数组系列/007.html)
67-
* [08.三数之和(15)](http://www.geekxh.com/1.0.数组系列/008.html)
68-
* [09.Z字形变换(6)](http://www.geekxh.com/1.0.数组系列/009.html)
69-
70-
* [2.链表]()
71-
* [01.删除链表倒数第N个节点(19)](http://www.geekxh.com/1.1.链表系列/101.html)
72-
* [02.合并两个有序链表(21)](http://www.geekxh.com/1.1.链表系列/102.html)
73-
* [03.环形链表(21)](http://www.geekxh.com/1.1.链表系列/103.html)
74-
* [04.两数相加(2)](http://www.geekxh.com/1.1.链表系列/104.html)
75-
76-
* [3.动态规划]()
77-
* [01.爬楼梯(70)](http://www.geekxh.com/1.2.动态规划系列/201.html)
78-
* [02.最大子序和(53)](http://www.geekxh.com/1.2.动态规划系列/202.html)
79-
* [03.最长上升子序列(300)](http://www.geekxh.com/1.2.动态规划系列/203.html)
80-
* [04.三角形最小路径和(120)](http://www.geekxh.com/1.2.动态规划系列/204.html)
81-
* [05.最小路径和(64)](http://www.geekxh.com/1.2.动态规划系列/205.html)
82-
* [06.打家劫舍(198)](http://www.geekxh.com/1.2.动态规划系列/206.html)
83-
84-
* [4.字符串]()
85-
* [01.反转字符串(344)](http://www.geekxh.com/1.3.字符串系列/301.html)
86-
* [02.字符串中的第一个唯一字符(387)](http://www.geekxh.com/1.3.字符串系列/302.html)
87-
* [03.实现 Sunday 匹配](http://www.geekxh.com/1.3.字符串系列/303.html)
88-
* [04.大数打印](http://www.geekxh.com/1.3.字符串系列/304.html)
89-
* [05.验证回文串(125)](http://www.geekxh.com/1.3.字符串系列/305.html)
90-
* [06.KMP 精讲](http://www.geekxh.com/1.3.字符串系列/306.html)
91-
* [07.旋转字符串(796)](http://www.geekxh.com/1.3.字符串系列/307.html)
92-
* [08.最后一个单词的长度(58)](http://www.geekxh.com/1.3.字符串系列/308.html)
93-
94-
* [5.二叉树]()
95-
* [01.最大深度与DFS(104)](http://www.geekxh.com/1.4.二叉树系列/401.html)
96-
* [02.层次遍历与BFS(102)](http://www.geekxh.com/1.4.二叉树系列/402.html)
97-
* [03.BST与其验证(98)](http://www.geekxh.com/1.4.二叉树系列/403.html)
98-
* [04.BST 的查找(700)](http://www.geekxh.com/1.4.二叉树系列/404.html)
99-
* [05.BST 的删除(450)](http://www.geekxh.com/1.4.二叉树系列/405.html)
100-
* [06.平衡二叉树(110)](http://www.geekxh.com/1.4.二叉树系列/406.html)
101-
* [07.完全二叉树(222)](http://www.geekxh.com/1.4.二叉树系列/407.html)
102-
* [08.二叉树的剪枝(814)](http://www.geekxh.com/1.4.二叉树系列/408.html)
103-
104-
* [6.滑动窗口]()
105-
* [01.滑动窗口最大值(239)](http://www.geekxh.com/1.5.滑动窗口系列/501.html)
106-
* [02.无重复字符的最长子串(3)](http://www.geekxh.com/1.5.滑动窗口系列/502.html)
107-
* [03.找到字符串中所有字母异位词(438)](http://www.geekxh.com/1.5.滑动窗口系列/503.html)
108-
* [04.和为s的连续正数序列](http://www.geekxh.com/1.5.滑动窗口系列/504.html)
109-
110-
* [7.博弈论系列]()
111-
* [01.囚徒困境](http://www.geekxh.com/1.6.博弈论系列/601.html)
112-
* [02.辛普森悖论](http://www.geekxh.com/1.6.博弈论系列/602.html)
113-
* [03.红眼睛和蓝眼睛](http://www.geekxh.com/1.6.博弈论系列/603.html)
114-
* [04.海盗分金币](http://www.geekxh.com/1.6.博弈论系列/604.html)
115-
* [05.智猪博弈](http://www.geekxh.com/1.6.博弈论系列/605.html)
116-
* [06.生男生女的问题](http://www.geekxh.com/1.6.博弈论系列/606.html)
117-
* [07.硬币问题](http://www.geekxh.com/1.6.博弈论系列/607.html)
118-
* [08.画圈圈的问题](http://www.geekxh.com/1.6.博弈论系列/608.html)
119-
* [09.巧克力问题](http://www.geekxh.com/1.6.博弈论系列/609.html)
120-
* [10.大鱼和小鱼的问题](http://www.geekxh.com/1.6.博弈论系列/610.html)
121-
122-
* [8.位运算系列]()
123-
* [01.使用位运算求和](http://www.geekxh.com/1.8.位运算系列/801.html)
124-
* [02.2的幂(231)](http://www.geekxh.com/1.8.位运算系列/802.html)
125-
* [03.返回一个数二进制中1的个数](http://www.geekxh.com/1.8.位运算系列/803.html)
126-
* [04.只出现一次的数字](http://www.geekxh.com/1.8.位运算系列/804.html)
127-
* [05.只出现一次的数字Ⅱ](http://www.geekxh.com/1.8.位运算系列/805.html)
128-
* [06.缺失数字(268)](http://www.geekxh.com/1.8.位运算系列/806.html)
129-
130-
* [9.二分法系列]()
131-
* [01.爱吃香蕉的珂珂(875)](http://www.geekxh.com/1.9.二分法系列/901.html)
132-
* [02.x的平方根(69)](http://www.geekxh.com/1.9.二分法系列/902.html)
133-
* [03.x的平方根(69)](http://www.geekxh.com/1.9.二分法系列/903.html)
134-
* [04.旋转排序数组中的最小值Ⅰ(153)](http://www.geekxh.com/1.9.二分法系列/904.html)
135-
* [05.旋转排序数组中的最小值Ⅱ(154)](http://www.geekxh.com/1.9.二分法系列/905.html)
136-
* [06.供暖器(475)](http://www.geekxh.com/1.9.二分法系列/906.html)
137-
138-
* [其他补充题目]()
139-
* [01.螺旋矩阵(54)](http://www.geekxh.com/1.99.其他补充题目/01.html)
140-
* [02.只有两个键的键盘(650)](http://www.geekxh.com/1.99.其他补充题目/02.html)
141-
* [03.24点游戏(679)](http://www.geekxh.com/1.99.其他补充题目/03.html)
142-
* [04.飞机座位分配概率(1227)](http://www.geekxh.com/1.99.其他补充题目/04.html)
143-
* [05.水分子的产生](http://www.geekxh.com/1.99.其他补充题目/05.html)
144-
* [06.救生艇(881)](http://www.geekxh.com/1.99.其他补充题目/06.html)
145-
* [07.救生艇(881)](http://www.geekxh.com/1.99.其他补充题目/07.html)
146-
* [08.灯泡开关(319)](http://www.geekxh.com/1.99.其他补充题目/08.html)
147-
* [09.三门问题](http://www.geekxh.com/1.99.其他补充题目/09.html)
148-
* [10.猜数字游戏(299)](http://www.geekxh.com/1.99.其他补充题目/10.html)
149-
* [11.LRU缓存机制(146)](http://www.geekxh.com/1.99.其他补充题目/11.html)
150-
* [12.最小的k个数](http://www.geekxh.com/1.99.其他补充题目/12.html)
151-
* [13.不同路径](http://www.geekxh.com/1.99.其他补充题目/13.html)
152-
* [14.不同路径-障碍物](http://www.geekxh.com/1.99.其他补充题目/14.html)
153-
* [15.连续n个数的和](http://www.geekxh.com/1.99.其他补充题目/15.html)
154-
* [16.盛水最多的容器](http://www.geekxh.com/1.99.其他补充题目/16.html)
155-
* [17.扑克牌中的顺子容器](http://www.geekxh.com/1.99.其他补充题目/17.html)
156-
* [18.整数拆分(343)](http://www.geekxh.com/1.99.其他补充题目/18.html)
157-
* [19.移动石子到连续(1033)](http://www.geekxh.com/1.99.其他补充题目/19.html)
158-
* [20.Nim游戏(292)](http://www.geekxh.com/1.99.其他补充题目/20.html)
159-
* [21.寻找两个正序数组的中位数(4)](http://www.geekxh.com/1.99.其他补充题目/21.html)
160-
* [22.第k个最大元素(215)](http://www.geekxh.com/1.99.其他补充题目/22.html)
161-
* [23.镜面反射(858)](http://www.geekxh.com/1.99.其他补充题目/23.html)
162-
* [25.整数转罗马数字(12)](http://www.geekxh.com/1.99.其他补充题目/25.html)
163-
* [26.荷兰国旗问题](http://www.geekxh.com/1.99.其他补充题目/26.html)
164-
* [27.六九问题](http://www.geekxh.com/1.99.其他补充题目/27.html)
165-
* [28.有效的数独](http://www.geekxh.com/1.99.其他补充题目/28.html)
166-
* [29.费米估算](http://www.geekxh.com/1.99.其他补充题目/29.html)
167-
* [30.分发饼干](http://www.geekxh.com/1.99.其他补充题目/30.html)
168-
* [31.生命游戏(289)](http://www.geekxh.com/1.99.其他补充题目/31.html)
169-
* [32.搜索二维矩阵(74)](http://www.geekxh.com/1.99.其他补充题目/32.html)
170-
* [33.子集(78)](http://www.geekxh.com/1.99.其他补充题目/33.html)
171-
* [34.面试中的智力题](http://www.geekxh.com/1.99.其他补充题目/34.html)
172-
* [35.旋转图像(48)](http://www.geekxh.com/1.99.其他补充题目/51.html)
173-
174-
175-
* [其他:排序专栏]()
176-
* [排序算法](http://www.geekxh.com/2.0.排序系列/0.hello.html)
177-
* [冒泡排序](http://www.geekxh.com/2.0.排序系列/1.bubbleSort.html)
178-
* [选择排序](http://www.geekxh.com/2.0.排序系列/2.selectionSort.html)
179-
* [插入排序](http://www.geekxh.com/2.0.排序系列/3.insertionSort.html)
180-
* [希尔排序](http://www.geekxh.com/2.0.排序系列/4.shellSort.html)
181-
* [归并排序](http://www.geekxh.com/2.0.排序系列/5.mergeSort.html)
182-
* [快速排序](http://www.geekxh.com/2.0.排序系列/6.quickSort.html)
183-
* [堆排序](http://www.geekxh.com/2.0.排序系列/7.heapSort.html)
184-
* [计数排序](http://www.geekxh.com/2.0.排序系列/8.countingSort.html)
185-
* [桶排序](http://www.geekxh.com/2.0.排序系列/9.bucketSort.html)
186-
* [基数排序](http://www.geekxh.com/2.0.排序系列/10.radixSort.html)
21+
4、mindMap_100(42 HD mind maps,No translation yet.....)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int trapped_water(int array[],int size){
5+
int amount = 0;
6+
int left[size],right[size];
7+
left[0] = array[0]; right[size-1] = array[size-1];
8+
for(int i = 1; i < size; i++){
9+
left[i] = max(left[i-1],array[i]);
10+
}
11+
for(int i = size-2; i >=0; i--){
12+
right[i] = max(right[i+1],array[i]);
13+
}
14+
for(int i = 0 ; i < size;i++){
15+
amount += min(left[i],right[i]) - array[i];
16+
}
17+
return amount;
18+
}
19+
20+
int main(){
21+
int array[] = {1,0,3,4,5,0,5,7,7,8,9,0};
22+
int size = sizeof(array) / sizeof(int);
23+
cout << trapped_water(array,size);
24+
return 0;
25+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main(){
4+
int n,k;
5+
cout << "Enter the number and the value of K : ";
6+
cin >> n >> k;
7+
int mask = 1 << (k-1);
8+
if(n & mask){
9+
cout << "Yes K-th bit is set" << endl;
10+
}
11+
else{
12+
cout << "No K-th bit is not set" << endl;
13+
}
14+
return 0;
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main(){
4+
int n,k,mask;
5+
cout << "Enter the number and the value of K : ";
6+
cin >> n >> k;
7+
mask = ~(1 << (k-1));
8+
n = n&mask;
9+
cout << "The number after clearing the K-th bit is : " << n << endl;
10+
return 0;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main(){
4+
int n,k;
5+
cout << "Enter the number and the value of K :";
6+
cin >> n >> k;
7+
int mask = 1 << (k - 1);
8+
n = n | mask;
9+
cout << "The number after setting the K-th bit is:" << n;
10+
return 0;
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main(){
4+
int n;
5+
cout << "Enter the number : ";
6+
cin >> n ;
7+
n = n & (n-1);
8+
cout << "The number after toggling right most set bit : " << n << endl;
9+
return 0;
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main(){
4+
int n,k,mask;
5+
cout << "Enter the number and the value of K : ";
6+
cin >> n >> k;
7+
mask = 1 << (k-1);
8+
n = n ^ mask;
9+
cout << "The number after toggling the K-th bit is : " << n << endl;
10+
return 0;
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
int editDistance(string s1, string s2){
2+
int m = s1.length();
3+
int n = s2.length();
4+
int dp[m+1][n+1];
5+
for (int i = 0; i <= m; i++) {
6+
dp[i][0] = i;
7+
}
8+
for (int j = 0; j <= n; j++) {
9+
dp[0][j] = j;
10+
}
11+
12+
for (int i = 1; i <= m; i++) {
13+
for (int j = 1; j <= n; j++) {
14+
if (s1[i-1] == s2[j-1]) dp[i][j] = dp[i-1][j-1];
15+
else dp[i][j] = 1 + min(min(dp[i][j-1],dp[i-1][j]),dp[i-1][j-1]);
16+
}
17+
}
18+
return dp[m][n];
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
int lcs(string x,string y){
2+
int m = x.size(),n = y.size();
3+
int dp[m+1][n+1];
4+
for(int i=0;i<=m;i++){
5+
dp[i][0] = 0;
6+
}
7+
for(int j=0;j<=m;j++){
8+
dp[0][j] = 0;
9+
}
10+
for(int i=1;i<=m;i++){
11+
for(int j=1;j<=n;j++){
12+
if(x[i-1] == y[j-1]){
13+
dp[i][j] = dp[i-1][j-1]+1;
14+
}
15+
else{
16+
dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
17+
}
18+
}
19+
}
20+
return dp[m][n];
21+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int longest_common_substring(string x,string y){
5+
int m = x.size();
6+
int n = y.size();
7+
int lcs[m+1][n+1];
8+
for(int i = 0 ; i < m; i++){
9+
lcs[i][0] = 0;
10+
}
11+
for(int j = 0; j < n; j++){
12+
lcs[0][j] = 0;
13+
}
14+
for(int i = 1; i <= m; i++){
15+
for(int j = 1; j <=n; j++){
16+
if(x[i-1] == y[j-1]){
17+
lcs[i][j] = 1 + lcs[i-1][j-1];
18+
}
19+
else{
20+
lcs[i][j] = 0;
21+
}
22+
}
23+
}
24+
return lcs[m][n];
25+
}
26+
int main(){
27+
string x,y;
28+
cin >> x >> y;
29+
cout << longest_common_substring(x,y);
30+
return 0;
31+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
int lis(int array[],int n){
2+
int dp[n],lis_value = -1;
3+
for(int i=0;i<n;i++){
4+
dp[i] = 1;
5+
}
6+
for(int i=1;i<n;i++){
7+
for(int j=0;j<i;j++){
8+
if(array[i] > array[j] and dp[i] < dp[j]+1){
9+
dp[i] = dp[j] + 1;
10+
}
11+
}
12+
}
13+
for(int i=0;i<n;i++){
14+
if(lis_value < dp[i]){
15+
lis_value = dp[i];
16+
}
17+
}
18+
return lis_value;
19+
}

0 commit comments

Comments
 (0)