Back to course home
0% completed
Vote For New Content
Solution: Pseudo-Palindromic Paths in a Binary Tree
Problem Statement
Given a binary tree where each node has a value between 1 and 9, return the number of "pseudo-palindromic" paths from the root node to any leaf node.
A path is called "pseudo-palindromic" if the values along the path can be rearranged to form a palindrome.
Examples
Example 1
- Input:
5 / \ 4 1 / \ \ 4 1 1 - Expected Output: 2
- Justification: The paths are:
- 5 → 4 → 4 (pseudo-palindromic: "5, 4, 4" can be rearranged to "4, 5, 4")
.....
.....
.....
Like the course? Get enrolled and start learning!