Largest two-digit number
EasyStrings7 min
The input is a string of digits, at least two characters long. Write a function maxTwoDigit(digits) that finds the largest number made of two neighbouring digits and returns it as a number.
Examples
maxTwoDigit('34987')Returns 98
maxTwoDigit('1205')Returns 20
maxTwoDigit('05')Returns 5
Asked at Druva · Source
Loading the editor...
- Input
maxTwoDigit('34987')Expected98 - Input
maxTwoDigit('1205')Expected20 - Input
maxTwoDigit('05')Expected5
Hidden tests run on Submit