
You are given:
items
(you can assume it fits in memory).
pageSize > 0
.
Design and implement a pagination helper that supports the following operations:
pageSize
.
pageIndex
(0-based), return the subarray of items that belongs to that page.
[0, pageSize - 1]
(if they exist),
[pageSize, 2 * pageSize - 1]
, and so on.
pageIndex
is out of range (no items on that page), return an empty list.
Assume:
0 <= pageIndex
1 <= pageSize <= 10^5
0 <= len(items) <= 10^6
Define the interface and implement the core method(s) for pagination. Focus on clean indexing and handling boundary cases correctly.