LeetCode 01 Two Sum swift
class TwoSum { func sumTow(nums: [Int], target: Int)->[Int]{ var ret:[Int]=[0,0]; for (var x=0;x<nums.count;x++){ for(var y=x+1;y<nums.count;y++){ if(target==nums[x]+nums[y]){ ret[0]=x+1 ret[1]=y+1 } } } return ret; } }
class TwoSum { func sumTow(nums: [Int], target: Int)->[Int]{ var ret:[Int]=[0,0]; for (var x=0;x<nums.count;x++){ for(var y=x+1;y<nums.count;y++){ if(target==nums[x]+nums[y]){ ret[0]=x+1 ret[1]=y+1 } } } return ret; } }