File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
solution/3500-3599/3590.Kth Smallest Path XOR Sum Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -177,8 +177,11 @@ class BinarySumTrie:
177177 else :
178178 return - 1
179179
180+
180181class Solution :
181- def kthSmallest (self , par : List[int ], vals : List[int ], queries : List[List[int ]]) -> List[int ]:
182+ def kthSmallest (
183+ self , par : List[int ], vals : List[int ], queries : List[List[int ]]
184+ ) -> List[int ]:
182185 n = len (par)
183186 tree = [[] for _ in range (n)]
184187 for i in range (1 , n):
@@ -207,7 +210,10 @@ class Solution:
207210 for child in tree[node]:
208211 dfs(child)
209212 if trie_pool[node].count < trie_pool[child].count:
210- trie_pool[node], trie_pool[child] = trie_pool[child], trie_pool[node]
213+ trie_pool[node], trie_pool[child] = (
214+ trie_pool[child],
215+ trie_pool[node],
216+ )
211217 for val in trie_pool[child].collect():
212218 if not trie_pool[node].exists(val):
213219 trie_pool[node].add(val, 1 )
@@ -219,7 +225,6 @@ class Solution:
219225
220226 dfs(0 )
221227 return result
222-
223228```
224229
225230#### Java
You can’t perform that action at this time.
0 commit comments