Robinhood interview question

Write a pure thread safe array in swift