Mode entretien. Minuteur de 7 min, sans indices ni autocomplétion
Largest two-digit number
FacileStrings7 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.
Exemples
maxTwoDigit('34987')Renvoie 98
maxTwoDigit('1205')Renvoie 20
maxTwoDigit('05')Renvoie 5
Posé chez Druva · Source
Chargement de l'éditeur...
- Entrée
maxTwoDigit('34987')Attendu98 - Entrée
maxTwoDigit('1205')Attendu20 - Entrée
maxTwoDigit('05')Attendu5
Les tests cachés se lancent à la soumission