Pergunta de entrevista da empresa Dynatrace

a small algorithm task traversing DOM tree