Axoni Interview Question

Typical coding puzzle about data structures. Had to code on google docs.