Skip to content

Commit 7fe4277

Browse files
committed
#704: description update
1 parent 40a2889 commit 7fe4277

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

c-sharp/Problems/binary-search/BinarySearchSolution.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,28 @@
33
* Binary Search
44
**
55
* Given an array of integers nums which is sorted in ascending order,
6-
* and an integer target, write a function to search target in nums.
6+
* and an integer target,
7+
* write a function to search target in nums.
8+
*
79
* If target exists, then return its index. Otherwise, return -1.
810
*
911
* You must write an algorithm with O(log n) runtime complexity.
12+
*
13+
* Example 1:
14+
* Input: nums = [-1,0,3,5,9,12], target = 9
15+
* Output: 4
16+
* Explanation: 9 exists in nums and its index is 4
17+
*
18+
* Example 2:
19+
* Input: nums = [-1,0,3,5,9,12], target = 2
20+
* Output: -1
21+
* Explanation: 2 does not exist in nums so return -1
22+
*
23+
* Constraints:
24+
* • 1 <= nums.length <= 10^4
25+
* • -10^4 < nums[i], target < 10^4
26+
* • All the integers in nums are unique.
27+
* • nums is sorted in ascending order.
1028
**
1129
* https://leetcode.com/problems/binary-search/
1230
***/

0 commit comments

Comments
 (0)