Appian interview question

We need you to code a function that returns the first repeated element or a list