Link Search Menu Expand Document

Paging

For a given array of integers, the page size and 1-based page index, print the items of that page.

Example:

int[] items = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
int pageSize = 5;
int pageIndex = 2;

The output should print: 6, 7, 8, 9, 10

Hint 1: Try to cover all the edge cases. What if in the example above the `pageIndex` was `3`? What if it was `5`?