Skip to content

Commit 9db204d

Browse files
authored
Revert "Revert "33 (java)、题目编号统一修改为四位数""
1 parent cbcdd4c commit 9db204d

File tree

339 files changed

+130
-80
lines changed

Some content is hidden

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

339 files changed

+130
-80
lines changed

README.md

Lines changed: 80 additions & 80 deletions

Rename folder.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package main
2+
3+
import (
4+
"io/ioutil"
5+
"os"
6+
"strings"
7+
)
8+
9+
func main() {
10+
myfolder := "D:/workspace/bluesword/leetcode/solution"
11+
files, _ := ioutil.ReadDir(myfolder)
12+
for _, file := range files {
13+
if file.IsDir() {
14+
name := file.Name()
15+
split := strings.Split(name, ".")
16+
os.Rename(myfolder+"/"+name, myfolder+"/"+"0"+split[0]+"."+strings.TrimSpace(split[1]))
17+
} else {
18+
continue
19+
}
20+
}
21+
22+
/*file := "C:\\\\log\\\\2013.log" //源文件路径
23+
err := os.Rename(file, "C:\\\\log\\\\install.txt") //重命名 C:\\log\\2013.log 文件为install.txt
24+
if err != nil {
25+
//如果重命名文件失败,则输出错误 file rename Error!
26+
fmt.Println("file rename Error!")
27+
//打印错误详细信息
28+
fmt.Printf("%s", err)
29+
} else {
30+
//如果文件重命名成功,则输出 file rename OK!
31+
fmt.Println("file rename OK!")
32+
}*/
33+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public int search(int[] A, int target) {
3+
if (A == null || A.length == 0) return -1;
4+
int low = 0,high = A.length - 1;
5+
while (low <= high) {
6+
int mid = (low + high) / 2;
7+
if (target < A[mid]) {
8+
if (A[mid] >= A[high] && target < A[low]) low = mid + 1;
9+
else high = mid - 1;
10+
} else if (target > A[mid]) {
11+
if (A[low] >= A[mid] && target > A[high]) high = mid - 1;
12+
else low = mid + 1;
13+
} else return mid;
14+
}
15+
return -1;
16+
}
17+
}

0 commit comments

Comments
 (0)