79387283

Date: 2025-01-25 18:39:24
Score: 1
Natty:
Report link

Do you want to check only for contiguous triplets of the form (a, b, b)? Based on your example, that doesn't seem to be the case. Then, you can just count the number of unique values and repeated values and multiply them.

In the example [5,6,7,3,3,3],

count_of_unique_vals = 3     # 5, 6 and 7
count_of_repeated_vals = 1   # 3
count_of_triplets = 3        # 3*1, or len(unique_vals) * len(repeated_vals)
Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: SivaTN