dsa2 min read
Squares of Sorted Array [Easy] — Two Pointers Fill from End
Return squares of a sorted array in sorted order using two pointers that compare absolute values from both ends.
Read →
webcoderspeed.com
1276 articles
Return squares of a sorted array in sorted order using two pointers that compare absolute values from both ends.
Remove all occurrences of val in-place using a write pointer pattern, returning the new length.
Remove duplicates in-place from a sorted array using a write pointer that only advances on unique elements.
Merge two sorted arrays in-place from the end to avoid overwriting elements using three pointers.
Check if string s is a subsequence of t using a greedy two-pointer scan that matches characters in order.