Interview question asked to Data Scientists interviewing at Elastic, Grab, Slack and other companies. Original question asked: How would you ensure the correctness of this code, and what edge cases should we consider?.