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 b7c1554 commit 8c61285Copy full SHA for 8c61285
1 file changed
two-sum/gyeo-ri.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def twoSum(self, nums: list[int], target: int) -> list[int]:
3
+
4
+ for idx1, num1 in enumerate(nums):
5
+ back = nums[idx1 + 1 :]
6
+ for idx2, num2 in enumerate(back):
7
+ if num1 + num2 == target:
8
+ return [idx1, idx1 + idx2 + 1]
9
10
+ raise Exception("Invalid nums and target")
0 commit comments