Open IgSaf opened 3 years ago
There is a copy of list in unfold function. It leads to O(len(remains)) time complexity for this operation. And due to being inside while remainder > 0 this gains O(n^2) time complexity for the whole implementation (e.g. for "aaaaab").
O(len(remains))
while remainder > 0
"aaaaab"
There is a copy of list in unfold function. It leads to
O(len(remains))
time complexity for this operation. And due to being insidewhile remainder > 0
this gains O(n^2) time complexity for the whole implementation (e.g. for"aaaaab"
).