Digital Clock Matches Puzzle
Julia, 160 157 154

x-&gt;(c=count_ones;l=[119;36;93;109;46;107;123;37;127;111];m=l[x+1];n=map(a-&gt;c(a)==mean(map(c,m))?sum(map(b-&gt;c(a$b),m)):1/0,l);find(n.==minimum(n).!=1/0)-1)


This is a lambda function. Assign it to a variable to call it. Accepts a vector of integers in range 0-9 of any length and returns a (possibly empty) vector of results.

Test cases

julia&gt; clock = x-&gt;(c=co...        # assign function to variable
(anonymous function)

julia&gt; clock([1 2 3])
1-element Array{Int64,1}:
 4

julia&gt; clock([1 2 1 2])
0-element Array{Int64,1}

julia&gt; clock([6 5 4])
1-element Array{Int64,1}:
 5

clock([6 0 9])
3-element Array{Int64,1}:
 0
 6
 9


Explanation

Enumerate the seven segments and represent them as a bit vector.

+---+                     +-0-+
|   |      Enumerate      1   2
+---+   &gt;  the seven  &gt;   +-3-+
|   |      segments       4   5
+---+                     +-6-+


Example: 1 (segments 2 + 5 enabled) becomes 36 (bits 2 + 5 set).
Here are the representations for digits 0-9.

l=[119;36;93;109;46;107;123;37;127;111];
m=l[x+1];


We can use the digit as index to get it's bit vector representation. +1 because of 1-based indexing in julia.

The function c=count_ones; counts the number of 1-bits in an integer. We assign an alias because we need it more often.

The full program, somewhat ungolfed:

x-&gt;(
  c=count_ones;
  l=[119;36;93;109;46;107;123;37;127;111];
  m=l[x+1];
  n=map(a-&gt;c(a)==mean(map(c,m))?sum(map(b-&gt;c(a$b),m)):1/0,l);
  find(n.==minimum(n).!=1/0)-1
)


Now, the last two lines in detail:

mean(map(c,m)) calculates the average number of lines per input digit.

n=map(a-&gt;...,l) loops over the vector representation of all digits.

If the number of lines of our current digit a is unequal to the average linecount of the input, return inf.

c(a)==mean(map(c,m))?...:1/0


If not, return the sum of the Hamming Distances between our current and all input digits.

sum(map(b-&gt;c(a$b),m))


We now have a vector n of length 10 representing the numbers 0-9 that gives us the total number of additions/deletions we have to perform to tranform all input digits to that number, or inf, if such a transformation is impossible without changing the number of lines.

find(n.==minimum(n).!=1/0)-1


Finally, output the locations (0-based) of all minima that are not inf.