Elixir sort then O(n^2)
Code\n\ndefmodule Solution do\n  @spec recover_array(nums :: [integer]) :: [integer]\n  def recover_array(nums) do\n    n = length(nums) |> div(2)\n    list = E
# Code\n```\ndefmodule Solution do\n  @spec recover_array(nums :: [integer]) :: [integer]\n  def recover_array(nums) do\n    n = length(nums) |> div(2)\n    list = Enum.sort(nums)\n    find_original(list, list, n)\n  end\n\n  defp find_original(list = [a | _], [prev, b | tail], n) do\n    with true <- b > prev,\n    true <- rem(b - a, 2) == 0,\n    k = div(b - a, 2),\n    {ans, _, _} <- Enum.reduce_while(list, {[], :queue.new(), 0}, fn x, {ans, q, len} ->\n      cond do\n        {:value, x - k} == :queue.peek(q) ->\n          {:cont, {[x - k | ans], :queue.drop(q), len}}\n        len == n ->\n          {:halt, nil}\n        true ->\n          {:cont, {ans, :queue.in(x + k, q), len + 1}}\n      end\n    end) do\n      Enum.reverse(ans)\n    else\n      _ -> find_original(list, [b | tail], n)\n    end\n  end\nend\n```
['Sorting', 'Elixir']