class Solution(object):
def allPairs(self, array, target):
"""
input: int[] array, int target
return: int[][]
"""
res = []
for i in range(len(array)):
for j in range(i+1, len(array)):
if (array[i] + array[j] == target):
res.append([i, j])
return res
Easy problem...
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.