Interview Query

Last Page Number

Start Timer

0:00:00

Upvote
15
Downvote
Save question
Mark as completed
View comments (10)
Next question

We’re given an ascending string of integers that represents page numbers.

Write a function get_last_page to return the last page number in the string. If the string of integers is not in the correct page order, return the last number in order.

Example 1:

Input:

input = '12345'

Output:

output = 5

Example 2:

Input:

input = '12345678910111213'

Output:

output = 13

Example 3:

Input:

input = '1235678'

Output:

output = 3
.
.
.
.
.


Comments

Loading comments...