Skip to content

Commit 90a031a

Browse files
committed
Auto Update@2019-04-14 18:13:06.43
1 parent c23236a commit 90a031a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

CopyToHere.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ for /r %DIR% %%i in (*.java) do (
99
copy %%i .\Solutions\!str!.java
1010
)
1111
git add .
12-
git commit -m "Auto Update@%date%%time%"
12+
git commit -m "Auto Update@%date% %time%"
1313
git push origin master
1414
pause
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
public class Solution {
3+
4+
public int search(int[] nums, int target) {
5+
int index = -1;
6+
for (int i = 0; i < nums.length; i++) {
7+
if (nums[i] == target) {
8+
index = i;
9+
break;
10+
}
11+
if (nums[i] > target && i > 0 && nums[i - 1] < target) {
12+
break;
13+
}
14+
}
15+
return index;
16+
}
17+
18+
public static void main(String[] args) {
19+
int[] nums = {4,5,6,7,0,1,2};
20+
int target = 3;
21+
System.out.println(new Solution().search(nums, target));
22+
}
23+
24+
}

0 commit comments

Comments
 (0)