If both left and right are included (inclusive range), then:
- Length =
right - left + 1 - Example:
left = 2,right = 5⇒ elements are2,3,4,5⇒ length =5 - 2 + 1 = 4 - If
right < left, the range is empty ⇒ length is 0 (usually, depending on your definition).