Repository navigation
Commit a073c62
authored
Fix bug
The current code would fail when remove the root element in a tree where right subtree only have right child.
# 17
# 0 20
# -5 5 25
Current code would produce a result with duplicate elements
# 20
# 0 20
# -5 5 25
Trick is to move one the assignment to root value to the bottom1 parent 916ef1a commit a073c62
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
0 commit comments