<commit_before># Given an array of elements, return true if any element shows up three times in a row
# 
# Examples:
# got_three? [1, 2, 2, 2, 3]  # => true
# got_three? ['a', 'a', 'b']  # => false
# got_three? ['a', 'a', 'a']  # => true
# got_three? [1, 2, 1, 1]     # => false<commit_msg>Session 2 Challenge 8 passed<commit_after># Given an array of elements, return true if any element shows up three times in a row
#
# Examples:
# got_three? [1, 2, 2, 2, 3]  # => true
# got_three? ['a', 'a', 'b']  # => false
# got_three? ['a', 'a', 'a']  # => true
# got_three? [1, 2, 1, 1]     # => false

# This code will return true if any element shows up 3 times:
=begin
def got_three?(arr)
  result = false
  hash = Hash.new(0)
  arr.each.with_index { |a, idx| hash[a] += 1 if arr[idx] == arr[idx+1 }
  result = true if hash.any? {|hash, key| key >= 3}
  return result
end
=end

def got_three?(arr)
  result = false
  arr.each.with_index do |a, idx|
    result = true if arr[idx] == arr[idx+1] && arr[idx] == arr[idx+2]
  end
  return result
end
{'fraction_non_alphanumeric': 0.17596153846153847, 'fraction_numerical': 0.025961538461538463, 'mean_word_length': 3.4870689655172415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3283852', 'n_tokens_mistral': 418, 'n_tokens_neox': 400, 'n_words': 145}