3 ms·
Working with spans is fraught with peril, though. It invites off-by-one errors. If there's one person in the queue to the checkout, then span-wise, that person
by rhn_mk1 4y ago
Working with spans is fraught with peril, though. It invites off-by-one errors.
If there's one person in the queue to the checkout, then span-wise, that person is the start of the queue and the end of the queue. But if the start and end are the same, what is the length of the queue?
(If you still insist it's one, you'll not be able to answer the question where the start and end of an empty queue is. There is no first or last person!)