Bloomberg Interview Question

Questions from leet code website.