Home
← All questions

Find the matching element in a mirrored DOM tree | Frontend Machine Coding

MediumPremiumMachine Coding

Asked at Swiggy

Frontend Machine Coding interview practice: Given two containers with identical structure and a target node in the first, find the node at the same position in the…

Problem

Two DOM trees rootA and rootB have identical structure. Given a target element inside rootA, return the element at the same position inside rootB.

function findCorrespondingNode(rootA, rootB, target) {
  // your code
}
Premium question

Unlock the in-browser editor, test cases, and model solution with Mentoxis Premium.

Unlock with Premium