Adobe interview question

Graph DS questions LC medium