1457. Pseudo-Palindromic Paths in a Binary Tree

Problem Statement

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

Intuition

https://leetcode.com/problems/pseudo-palindromic-paths-in-a-binary-tree/description/?envType=daily-question&envId=2024-01-24

https://www.youtube.com/watch?v=P0bAPxMkjnk&t=32s&ab_channel=AryanMittal

Approach 1:

Approach 2:

Approach 3:

Approach 4:

Similar Problems

Last updated