Triple Four

ABC 396

Problem 20 of 50

Easy

What to do

Given a list of integers, check if any value appears three or more times consecutively (in a row). Return 'Yes' if such a triple exists, 'No' otherwise. For example, [1, 4, 4, 4, 2] → 'Yes' because 4 appears three times in a row.

Key Concepts

if-statements loops arrays/lists input/output

Examples

Input: arr = [1, 4, 4, 4, 2]

Output: Yes

Input: arr = [2, 4, 4, 2, 2, 4]

Output: No

Tips for Beginners

  • Focus on understanding the logic, not memorizing syntax
  • Use print statements to debug your code
  • Don't worry about input parsing - the function handles that for you
  • If stuck, try writing out your solution on paper first

Python Editor

Loading Python...