Move both pointers
transcript
A shop pairs items whose prices add up to a target. Each item can go in one bundle only. A small slip reuses an item.
If the sum is too small, move the low pointer. If the sum is too big, move the high pointer. If it equals the target, count a bundle.
After a match, the code moves only the low pointer. The four then pairs with the second one. The answer is two. Move both pointers. The answer is one.
After a match, both items are used up. So move the low pointer in. And move the high pointer in too.
Test three equal items that pair up. Test items that could pair in two ways. Test an odd number of items.
A bundle is made of two different items. Each item is bought once, so it cannot be reused. Both pointers must move in after a match.
A match uses two items. Move both pointers in. Test three equal items. Full breakdown in the lecture.