input has list of nos output has all the possible pattern occurring and the position where the pattern break
input
[1,2,3,1,2,3,1,2,3,4,1,2,3,10,5,6,4,5,6,8,4,5,6,12,2,3]
output
[1,2,3]: 10th position and 14th
[4,5,6]:20th position and 24th
[1,2,3] and [4,5,6] all possible patter the position where the pattern breaks 10,14 for [1,2,3] and 20 and 24 for [4,5,6]
Code:
#split the list by sequences
#find duplicate lists
#create new dictionary with empty lists to store output
#main code, apply nested loop over
uniandseq, and compare the both lists, in simple term first try to the next not same list from[1,2,3]so first outcome will be[1,2,3,4]take thelast element 4and find theindex valueof it from input listplus 1will be the output.Output: