Implement a single-thread task scheduler API | Applied Interview Question