shorten.rb
# Length of the longest common prefix
Length of the longest common prefix
Length of the longest common prefix
def len_of_prefix(ls)
  if ls.size == 0
    0
  else
    min, max = ls.minmax
    i = 0
    while min[i] != nil && min[i] == max[i]
      i += 1
    end
    i
  end
end
def len_of_prefix ( ls ) if ls . size == 0 0 else min , max = ls . minmax i = 0 while min [ i ] != nil && min [ i ] == max [ i ] i += 1 end i end end
Length of the longest common prefix
Length of the longest common prefix
ls
<not_specific>