Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kirqe/797a3f8e187d746a18ce to your computer and use it in GitHub Desktop.
Save kirqe/797a3f8e187d746a18ce to your computer and use it in GitHub Desktop.
select an el which appears a few times in a row
a=['a','b','b','h','h','a']
puts a.select{|l| a.count(l)>1}.uniq
puts "--sec time in a row:--"
a.each_with_index do |item,index|
if item==a[index+1]
puts item
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment