Closed ZetrextJG closed 2 months ago
When calling the .nth() method on the Chars type ( Char iterator ) one will consume the iterator up to the n-th item and return that item if found https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.nth.
.nth()
The means that the previous implementation has quadratic complexity in the case of a multi-character line. This one is linear and will iterator over the line at most one time.
All the previous functionality has been accounted for. The tests pass.
Thanks for this!
When calling the
.nth()
method on the Chars type ( Char iterator ) one will consume the iterator up to the n-th item and return that item if found https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.nth.The means that the previous implementation has quadratic complexity in the case of a multi-character line. This one is linear and will iterator over the line at most one time.
All the previous functionality has been accounted for. The tests pass.