Interview Query

Last Page Number

10
Have you seen this question before?

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
Next question: Music Database
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code