What is the best way to find the period in a repeating list?
For example:
a = {4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2}
has repeat
#include #include using namespace std; int period(vector v) { int p=0; // period 0 for(int i=p+1; i v3{1,2,3,1,2,3,1,2,3}; cout<<"Period is :\t"< v0{1,2,3,1,2,3,1,9,6}; cout<<"Period is :\t"< v1{1,2,1,1,7,1,2,1,1,7,1,2,1,1}; cout<<"Period is :\t"<