Amazon interview question

Multithreading in a dsa question