Stock Ticker Interview Problem