LeetCode | 1.两数之和

 

暴力破解

 

nums = [2,7,13,15]
target = 17


for i in range(len(nums)):
    for j in range(i+1,len(nums)):
        if nums[i] + nums[j] == target:
            print(i,j)

 

posted @ 2021-08-03 16:37  黄金国的大象  阅读(19)  评论(0编辑  收藏  举报