func twoSum(nums []int, target int) []int { flag := make([]int, len(nums)) ans := make([]int, 0) for i, v := range nums { for j := i + 1; j < len(nums); j++ { if v + nums[j] == target && flag[i] != 1 && flag[j] != 1{ flag[i], flag[j] = 1, 1 ans = append(ans, i, j) } } } return ans }