Codegenio interview question

Detect patterns in arrays and design algorithm to sort them accordingly.