LearnPy Hub
← Arena
IntermediateRating 1300

Mirror Images

A binary tree is given level by level, with N for an empty spot (like LeetCode). Print YES if the tree is a mirror image of itself around its centre.

Input

One line of values and N.

Output

YES or NO.

Sample 1

Input
1 2 2 3 4 4 3
Output
YES

Sample 2

Input
1 2 2 N 3 N 3
Output
NO
solution.py
Output appears here
Mirror Images · Python Arena problem · LearnPy Hub