Clear Street interview question

Question based on designing an optimal Algorithm and questions around database design