Skip to content

Commit 46a9e27

Browse files
refactor 167 again
1 parent 242211f commit 46a9e27

File tree

1 file changed

+16
-10
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+16
-10
lines changed

src/main/java/com/fishercoder/solutions/_167.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22

33
/**
44
* 167. Two Sum II - Input array is sorted
5-
*
6-
* Given an array of integers that is already sorted in ascending order,
7-
* find two numbers such that they add up to a specific target number.
8-
* The function twoSum should return indices of the two numbers such that they add up to the target,
9-
* where index1 must be less than index2.
10-
* Please note that your returned answers (both index1 and index2) are not zero-based.
11-
* You may assume that each input would have exactly one solution.
12-
13-
Input: numbers={2, 7, 11, 15}, target=9
14-
Output: index1=1, index2=2
5+
6+
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
7+
8+
The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2.
9+
10+
Note:
11+
12+
Your returned answers (both index1 and index2) are not zero-based.
13+
You may assume that each input would have exactly one solution and you may not use the same element twice.
14+
15+
Example:
16+
17+
Input: numbers = [2,7,11,15], target = 9
18+
Output: [1,2]
19+
Explanation: The sum of 2 and 7 is 9. Therefore index1 = 1, index2 = 2.
20+
1521
*/
1622

1723
public class _167 {

0 commit comments

Comments
 (0)