Say I have an array of hash strings, e.g.
['a04a872ff4027233', '8cef496d2a92808c', etc.]
I would like an elegant way to determine what is the shortest uniform-length substring I can use to differentiate between the alternatives.
E.g. if the shortest length substring is 3, then the options could be abbreviated to [‘a04’, ‘8ce’, etc], and I could then just expand the abbreviation later.
I need a solution in Ruby.
1 Answer