LeetCode 01 Two Sum swift
2017-08-04 本文已影响0人
logke
func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
for x in 0 ..< nums.count{
for y in x+1 ..< nums.count{
if(target==nums[x]+nums[y]){
return [x,y]
}
}
}
return [0];
}