A window is a contiguous range
Updated
A window is the slice a[L..R]. Every index between L and R sits inside. You cannot skip a cell in the middle.
What to focus on
Once L and R are named with L ≤ R, the window is fully determined. Index i is in the window iff L ≤ i ≤ R. A gap is not a window.
Worked examples
middle slice
a = [4, 1, 9, 1], L=1 R=2- covers indices 1,2
- cells 1 then 9
- cannot skip 1 to take 9 alone as this L,R
Result: [1, 9]
whole array
a = [4, 1, 9], L=0 R=2- covers 0,1,2
- every cell is inside
Result: [4, 1, 9]
string slice
s = "abca", L=1 R=3- covers 1,2,3
- chars b,c,a
Result: "bca"
Try it
Write slice(a, L, R). a is an array of integers, or use s for a string. L is the left index. R is the right index. The window includes every index from L through R. Return the slice a[L..R]. On [4, 1, 9, 1] with (1, 2) and (0, 3); [4, 1, 9] with (0, 2); "abca" with (1, 3).
a (or s) is nonempty. 0 ≤ L ≤ R < n.