Amdocs interview question

pattern code ,logical question ,long chain