leetle

Daily challenge for 2026-04-11

466. Leaf Node Value Parity

You are given a binary tree represented as a list in level-order traversal (where null represents a missing node). A leaf node is a node with no children. Your task is to return true if all leaf nodes in the tree have the same parity (all even or all odd), and false otherwise. If the tree is empty, return true.

Example:
Input: root = [1, 2, 3, 4, null, null, 5]
Output: false
Explanation: The leaves are 4 (even) and 5 (odd). Since they have different parity, return false.

Run this challenge interactively in Python or JavaScript when the app loads.