Solve interval merging and histogram area | Bytedance Interview Question