Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a654b0

Browse files
add problem description
1 parentbf6a425 commit0a654b0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎Lintcode/src/chapter2_binary_search/SearchInsertPosition.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
packagechapter2_binary_search;
2+
/**Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
23
4+
You may assume NO duplicates in the array.
5+
6+
Have you met this question in a real interview? Yes
7+
Example
8+
[1,3,5,6], 5 → 2
9+
10+
[1,3,5,6], 2 → 1
11+
12+
[1,3,5,6], 7 → 4
13+
14+
[1,3,5,6], 0 → 0
15+
16+
*/
317
publicclassSearchInsertPosition {
418

519
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp