medium - accepted / - tried
Given two same DOM tree A, B, and an Element a in A, find the corresponding Element b in B.
By corresponding, we mean a and b have the same relative position to their DOM tree root.
This could a problem on general Tree structure with only
Could you solve it recursively and iteratively?
Could you solve this problem with special DOM api for better performance?
What are the time cost for each solution?
Let's try to solve this problem within 15 mintues.