Skip to content

Commit 2831914

Browse files
authoredJan 25, 2024
Update readme.md
1 parent b13a8ea commit 2831914

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎1457-pseudo-palindromic-paths/readme.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
- i.e. any permutation of the array is a palindrome then array is pseudo-palindrome.
66
- Return the number of pseudo-palindromic paths going from the root node to leaf nodes.
77

8-
**Example:**
9-
![tree-1](./assets/example-1.jpg)
8+
**Example:** \
9+
<img src="./assets/example-1.jpg" width=40% height=40%>
1010
>**Input:** root = `[2,3,1,3,1,null,1]` \
1111
**Output:** 2 \
1212
**Explanation:** The figure above represents the given binary tree. There are three paths going from the root node to leaf nodes: the red path `[2,3,3]`, the green path `[2,1,1]`, and the path `[2,3,1]`. Among these paths only red path and green path are pseudo-palindromic paths since the red path `[2,3,3]` can be rearranged in `[3,2,3]` (palindrome) and the green path `[2,1,1]` can be rearranged in `[1,2,1]` (palindrome).
13+
1314
[pseudo-palindromic-paths-in-a-binary-tree on leetcode](https://leetcode.com/problems/pseudo-palindromic-paths-in-a-binary-tree/description/)
1415

1516
## Solution
@@ -48,4 +49,4 @@ a palindrome can never be formed since the total length is even and there will a
4849
### Time Complexity
4950
O(n) since all the nodes are visited once.
5051
### Space Complexity
51-
O(1) since we are using bit-mapping to store the counts.
52+
O(1) since we are using bit-mapping to store the counts.

0 commit comments

Comments
 (0)
Please sign in to comment.