Skip to content

Commit 682e002

Browse files
authored
Merge pull request doocs#91 from bluesword12350/master
33 (java)、题目编号统一修改为四位数
2 parents 69bf54e + c21fd8a commit 682e002

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

+80-80

Rename folder.go

+33
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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+
}
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.
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.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)