Amazon interview question

Build a string based on a random adjacent list