Citadel Securities Interview Question

lc hard question with one follow up