Implement a fixed-capacity generic circular buffer | Applied Interview Question