golang
we know the smallest number in nums, is the smallest number in result + k. From there, try out all possible k from nums[i] - nums[0].\n\n\nfunc recoverArray(num
we know the smallest number in nums, is the smallest number in result + k. From there, try out all possible k from nums[i] - nums[0].\n\n```\nfunc recoverArray(nums []int) []int {\n    sort.Ints(nums)\n    freq := make(map[int]int)\n    for _, n := range nums {\n        freq[n]++\n    }\n    for i := 1; i<len(nums); i++ {\n        k := nums[i] - nums[0]\n        if k % 2 == 1 || k == 0 {  // k must be positive\n            continue\n        }\n        k /= 2\n        temp := make(map[int]int)\n        for k, v := range freq {\n            temp[k] = v\n        }\n        res := make([]int, 0)\n        for _, v := range nums {\n            if temp[v] > 0 {\n                temp[v]--\n                if temp[v + 2*k] == 0 {  // invalid k\n                    break\n                }\n                temp[v + 2*k]--\n                res = append(res, v + k)\n            }\n        }\n        if len(res) == len(nums) / 2 {\n            return res\n        }\n    }\n    \n    return nil\n}\n\n\n/*\n\nwe know the smallest number in nums is lowest val in res + k\n\nwe can reduce bounds of k to try\n\n*/\n```
[]