Samsung Electronics interview question

Question related to graph and puzzels.