3 ms·
Close, but not ideal - lines are occasionally very long, and you're wasting nodes on sequences of newlines. There's a number of useful data structures that can
by arc-in-space 5y ago
Close, but not ideal - lines are occasionally very long, and you're wasting nodes on sequences of newlines. There's a number of useful data structures that can do this well, like a 'rope'.