Hudson River Trading Interview Question

Classic coding question on python