Bloomberg Interview Question

2 leetcode medium problems and come up with their analyses.