Virtu Financial interview question

Programme code to solve math question