re: Daily Challenge #18 - Triple Trouble VIEW POST

FULL DISCUSSION
 

Ruby solution:

def triple_double(num1,num2)
  triples = num1.to_s.split("").chunk_while{|i, j| i == j }.to_a.select{|el| el.count >= 3 }.flatten
  doubles = num2.to_s.split("").chunk_while{|i, j| i == j }.to_a.select{|el| el.count >= 2 }.flatten

  common_integer = triples.uniq & doubles.uniq

  common_integer.empty? ? 0 : 1
end
code of conduct - report abuse