Pergunta de entrevista da empresa TikTok

Find the shortest average path node. Also needed time complexity