<t>Hey everybody, this is my first post so please tell me if I do something wrong. I had a go at this a little while ago as it seemed like a nice problem but forgot to post what I came up with. I thought people might find it interesting, mostly because if this came up in an interview my code is very...