Symmetric Tree
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
isSymmetric(tree([1, 2, 2, 3, 4, 4, 3])); // true
isSymmetric(tree([1, 2, 2, null, 3, null, 3])); // falseLoading compiler resources...
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
isSymmetric(tree([1, 2, 2, 3, 4, 4, 3])); // true
isSymmetric(tree([1, 2, 2, null, 3, null, 3])); // falseRun your code to see results.
This interactive challenge requires a DeepFrontend Pro membership. Get instant access to write, execute, test, and view verified solution code directly in your browser.
Regional pricing available • Instant access
Stuck? This challenge exercises: