Skip to content

Latest commit

 

History

History
6 lines (5 loc) · 292 Bytes

File metadata and controls

6 lines (5 loc) · 292 Bytes

Write a function that takes in a given list of integers nums and returns the number of times two consecutive elements in the list are the same.

For example:

  • consecutive_count([5, 5, 5, 6, 7]) → 2
  • consecutive_count([1, 2, 3, 4, 5]) → 0
  • consecutive_count([8, 8, 8, 8]) → 3