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:
177
177
else :
178
178
return - 1
179
179
180
+
180
181
class 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 ]:
182
185
n = len (par)
183
186
tree = [[] for _ in range (n)]
184
187
for i in range (1 , n):
@@ -207,7 +210,10 @@ class Solution:
207
210
for child in tree[node]:
208
211
dfs(child)
209
212
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
+ )
211
217
for val in trie_pool[child].collect():
212
218
if not trie_pool[node].exists(val):
213
219
trie_pool[node].add(val, 1 )
@@ -219,7 +225,6 @@ class Solution:
219
225
220
226
dfs(0 )
221
227
return result
222
-
223
228
```
224
229
225
230
#### Java
You can’t perform that action at this time.
0 commit comments