Commit f98e8946 authored by jxtxzzw's avatar jxtxzzw
Browse files

Update README.md, LeetCode/65.java files

parent 3884e823
Pipeline #434 passed with stage
in 34 seconds
static public boolean isNumber(String s) {
if (s == null || s.length() == 0) {
return false;
}
s = s.toUpperCase();
if (s.contains("E")) {
int split = s.indexOf("E");
String first = s.substring(0, split);
String second = s.substring(split + 1);
return (isDecimal(first) || isInteger(first)) && isInteger(second);
}
return isDecimal(s) || isInteger(s);
}
static private boolean isDecimal(String s) {
if (s == null || s.length() == 0) {
return false;
}
int cursor = 0;
if (s.charAt(0) == '-' || s.charAt(0) == '+') {
cursor = 1;
}
int pointCount = 0;
boolean numberExist = false;
while (cursor < s.length()) {
if (!Character.isDigit(s.charAt(cursor))) {
if (s.charAt(cursor) == '.') {
pointCount++;
if (pointCount > 1) {
return false;
} else {
cursor++;
continue;
}
} else {
return false;
}
} else {
numberExist = true;
}
cursor++;
}
return pointCount == 1 && numberExist;
}
static private boolean isInteger(String s) {
if (s == null || s.length() == 0) {
return false;
}
int cursor = 0;
boolean numberExist = false;
if (s.charAt(0) == '-' || s.charAt(0) == '+') {
cursor = 1;
}
while (cursor < s.length()) {
if (!Character.isDigit(s.charAt(cursor))) {
return false;
} else {
numberExist = true;
}
cursor++;
}
return numberExist;
}
......@@ -18,23 +18,23 @@ Use search to find what you want to see. Recommended to use https://record.jxtxz
---
共有记录 533 题 (records in total)
共有记录 534 题 (records in total)
+ CodeForces: 8
+ CSU: 1
+ EOJ: 196
+ HDU: 16
+ LeetCode: 222
+ LeetCode: 223
+ POJ: 13
+ UVa: 6
+ ZOJ: 1
+ 计蒜客: 68
+ 洛谷: 2
目前已整理代码 462 题 (with code and tags)
目前已整理代码 463 题 (with code and tags)
+ 172 题使用 C/C++ 编写 (solved with C/C++)
+ 282 题使用 Java 编写 (solved with Java)
+ 283 题使用 Java 编写 (solved with Java)
+ 1 题使用 Kotlin 编写 (solved with Kotlin)
+ 1 题使用 Python 编写 (solved with Python)
+ 5 题使用 Javascript 编写 (solved with Javascript)
......@@ -303,6 +303,7 @@ Use search to find what you want to see. Recommended to use https://record.jxtxz
| LeetCode | 59 | Spiral Matrix II | | | java |
| LeetCode | 62 | 不同路径 | | 动态规划 | java |
| LeetCode | 64 | Minimum Path | | 动态规划 | java |
| LeetCode | 65 | Valid Number | | | java |
| LeetCode | 66 | Plus One | | | java |
| LeetCode | 70 | 爬楼梯 | | 动态规划 | java |
| LeetCode | 71 | Simplify Path | 栈 | | java |
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment