Flexible Finance Interview Question

Hardest problem you solved. Implementation details.