Nice two-pointer. Easy to think but hard to take into account edge cases, at least for me...