In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 2nd
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #04 exercise sheet]
In this problem you should submit a function as described. Inside the function do not print anything that was not asked!
Sarah seeks to unlock the ancient spell of Numerus Maximus, a powerful incantation that reveals the longest ascending sequence of digits in a number. Can you help her unveil this numeric enchantment?
Write a function largest_sequence(num) that takes an integer num and returns the length of the longest (contiguous) sequence of digits that are in strictly increasing order.
The following limits are guaranteed in all the test cases that will be given to your program:
0 ≤ num ≤ 1050 | The integer from which to fing the longest ascending sequence |
Example Function Calls | Example Output |
print(largest_sequence(129643457)) print(largest_sequence(1213478911)) print(largest_sequence(123123412345)) |
4 6 5 |