TwoSum

LeetCode TwoSum 예제 Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. 내가 푼 풀이 func twoSum(nums []int, target int) []int { resultValue := make([]int, 2) for i := 0; i < len(nums); i++ { for j := 0; j < len(nums); j++ { if i == j { continue } if nums[i]+nums[j] == target { resultValue[0] = i resultValue[1] = j return resultValue } } }..