Algorithm · Microsoft · Easy
Problem Given the root of a binary tree, transform the tree into its mirror image and return the root of the transformed tree. At every node, exchange its left and right children, continuing throughout the tree. Each node keeps its original value; only the links between nodes change. A node is represented with the fields val, left, and right. Its default value is 0, and its child fields default to null. The input tree is supplied as a level-order array. Integer entries…
Checking your access…