TuringSense interview question

Generate functions to implement a circular buffer given an array.