Dynatrace interview question

a small algorithm task traversing DOM tree