提交 340d7eb3 编写于 作者: C CyC2018

auto commit

上级 a69252e1
...@@ -828,7 +828,7 @@ HTTP/1.1 的解析是基于文本的,而 HTTP/2.0 采用二进制格式。 ...@@ -828,7 +828,7 @@ HTTP/1.1 的解析是基于文本的,而 HTTP/2.0 采用二进制格式。
# 参考资料 # 参考资料
- 上野宣. 图解 HTTP[M]. Ren min you dian chu ban she, 2014. - 上野宣. 图解 HTTP[M]. 人民邮电出版社, 2014.
- [MDN : HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) - [MDN : HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP)
- [Are http:// and www really necessary?](https://www.webdancers.com/are-http-and-www-necesary/) - [Are http:// and www really necessary?](https://www.webdancers.com/are-http-and-www-necesary/)
- [HTTP (HyperText Transfer Protocol)](https://www.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html) - [HTTP (HyperText Transfer Protocol)](https://www.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* [访问权限](#访问权限) * [访问权限](#访问权限)
* [抽象类与接口](#抽象类与接口) * [抽象类与接口](#抽象类与接口)
* [super](#super) * [super](#super)
* [重载与重写](#重载与重写) * [覆盖与重载](#覆盖与重载)
* [五、String](#五string) * [五、String](#五string)
* [String, StringBuffer and StringBuilder](#string,-stringbuffer-and-stringbuilder) * [String, StringBuffer and StringBuilder](#string,-stringbuffer-and-stringbuilder)
* [String 不可变的原因](#string-不可变的原因) * [String 不可变的原因](#string-不可变的原因)
...@@ -706,11 +706,11 @@ SuperExtendExample.func() ...@@ -706,11 +706,11 @@ SuperExtendExample.func()
> [Using the Keyword super](https://docs.oracle.com/javase/tutorial/java/IandI/super.html) > [Using the Keyword super](https://docs.oracle.com/javase/tutorial/java/IandI/super.html)
## 重载与重写 ## 覆盖与重载
- 重写存在于继承体系中,指子类实现了一个与父类在方法声明上完全相同的一个方法; - 覆盖(Override)存在于继承体系中,指子类实现了一个与父类在方法声明上完全相同的一个方法;
- 重载即存在于继承体系中,也存在于同一个类中,指一个方法与已经存在的方法或者父类的方法名称上相同,但是参数类型、个数、顺序至少有一个不同。应该注意的是,返回值不同,其它都相同不算是重载。 - 重载(Overload)也存在于同一个类中,指一个方法与已经存在的方法名称上相同,但是参数类型、个数、顺序至少有一个不同。应该注意的是,返回值不同,其它都相同不算是重载。
# 五、String # 五、String
......
...@@ -1986,6 +1986,7 @@ public int longestSubStringWithoutDuplication(String str) { ...@@ -1986,6 +1986,7 @@ public int longestSubStringWithoutDuplication(String str) {
int curLen = 0; int curLen = 0;
int maxLen = 0; int maxLen = 0;
int[] indexs = new int[26]; int[] indexs = new int[26];
Arrays.fill(indexs, -1);
for (int i = 0; i < str.length(); i++) { for (int i = 0; i < str.length(); i++) {
int c = str.charAt(i) - 'a'; int c = str.charAt(i) - 'a';
int preIndex = indexs[c]; int preIndex = indexs[c];
...@@ -2010,21 +2011,19 @@ public int longestSubStringWithoutDuplication(String str) { ...@@ -2010,21 +2011,19 @@ public int longestSubStringWithoutDuplication(String str) {
## 解题思路 ## 解题思路
```java ```java
public int GetUglyNumber_Solution(int N) { public int GetUglyNumber_Solution(int index) {
if (N <= 6) return N; if (index <= 6) return index;
int i2 = 0, i3 = 0, i5 = 0; int i2 = 0, i3 = 0, i5 = 0;
int cnt = 1; int[] dp = new int[index];
int[] dp = new int[N];
dp[0] = 1; dp[0] = 1;
while (cnt < N) { for (int i = 1; i < index; i++) {
int n2 = dp[i2] * 2, n3 = dp[i3] * 3, n5 = dp[i5] * 5; int n2 = dp[i2] * 2, n3 = dp[i3] * 3, n5 = dp[i5] * 5;
int min = Math.min(n2, Math.min(n3, n5)); dp[i] = Math.min(n2, Math.min(n3, n5));
dp[cnt++] = min; if (dp[i] == n2) i2++;
if (min == n2) i2++; if (dp[i] == n3) i3++;
if (min == n3) i3++; if (dp[i] == n5) i5++;
if (min == n5) i5++;
} }
return dp[N - 1]; return dp[index - 1];
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册