Ha! I actually asked the exact same challenge by Amazon few months back. Sadly unable to solve it during the interview itself. But 1.5 hours afterwards, I solved it and then sent my solution to them. Didn't land the job though :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.