Bloomberg Interview Question

LC problem, and some c++ basic problem