DEV Community

Discussion on: Using Two-Pointer Technique to Optimize Algorithm Solutions

Collapse
 
nicolaslattuada profile image
nicolas lattuada

Nice one 👌
How about initializing the pointers at the end and start of the array and fill the result in descending order?
We could get rid of step 2

Collapse
 
liaowow profile image
Annie Liao

That sounds smart. Thanks for optimizing the optimization 🙌