We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76c1340 commit 304b398Copy full SHA for 304b398
two_sum.py
@@ -0,0 +1,20 @@
1
+def two_sum_sorted(array: list[int], target: int) -> str:
2
+ """This algorithm give an integer array, and an integer target.
3
+ So, return your target by additional of two indext of the array.
4
+
5
+ :param array: give a sorted integer array
6
+ """
7
8
+ left = 0
9
+ right = len(array) - 1
10
11
+ while left < right:
12
+ current = array[left] + array[right]
13
+ if current == target:
14
+ return "{} + {} = {}".format(array[left], array[right], target)
15
+ elif current > target:
16
+ right -= 1
17
+ elif current < target:
18
+ left += 1
19
+ return "So, you couldn't fund your target in this list..."
20
0 commit comments