Citadel Securities interview question

A DSA medium leetcode question