Given two binary tree with same structure but may have different arrangement of value and given an integer K. The task is to check that after exactly K swap on first tree, will it become mirror of second one. The idea is to traverse the first tree and check by swapping nodes recursively, if the tree becomes mirror image of second tree.

3m read time From geeksforgeeks.org
Post cover image

Sort: