← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a component for a data browser that requires interactive pagination. Your implementation must include a stateful class to manage the pagination state and render the UI string.
Implement the Paginator class:
Paginator(int totalPages, int visibleCount, int currentPage) - Initializes the paginator
totalPages: Total number of pages (1-indexed)visibleCount: Maximum page numbers to displaycurrentPage: Currently active page (1-indexed)String jump(int pageNumber) - Moves to specified page (clamped to valid range). Returns rendered UI string.
String left() - Moves one page left if possible. Returns rendered UI string.
String right() - Moves one page right if possible. Returns rendered UI string.
UI Rendering Rules:
"< " if currentPage > 1" >" if currentPage < totalPages*)