ruby array中找出重复元素
def mostused(ahash) original_size = ahash.size sizes = {} ahash.uniq.map { |x| sizes[x] = original_size - ((ahash - [x]).size)} sizes.sort_by {|k,v| v}.pop end