Amazon interview question

Dont remember but lc medium usually graph based