Question d’entretien chez Included Health

Refactor this poorly written code implementing an algorithm already available in a thoroughly tested, efficient, and extremely widely adopted software package while pretending it doesn't exist.