Question: This is C Programming Write a function that takes in an array arr and its size n, and returns 1 if the array has no
This is C Programming
Write a function that takes in an array arr and its size n, and returns 1 if the array has no 3 consecutive members that are the same (so no consecutive triplets), otherwise the function returns 0. For example, for {1,1,1,2} the function returns 0 since first, second and third elements are the same (1). For {1,1,2,6,2,2} the function returns 1 since there are NO three identical elements that are consecutive (2 is not repeated three times consecutively).
Easiest way is to use one loop and check current, next and after next member in the loop body. Do not add any code for main.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
