1457. Pseudo-Palindromic Paths in a Binary Tree

https://leetcode.com/problems/pseudo-palindromic-paths-in-a-binary-tree

Description

Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node values in the path is a palindrome.

Return the number of pseudo-palindromic paths going from the root node to leaf nodes.

Example 1:

Example 2:

Example 3:

Constraints:

  • The number of nodes in the tree is in the range [1, 105].

  • 1 <= Node.val <= 9

ac

Last updated

Was this helpful?