Dato un intero positivo n come input, genera la somma dell'intervallo inverso di n.
Una somma dell'intervallo invertito viene creata facendo un intervallo inclusivo fino a n, iniziando con 1 e includendo n, invertendo ciascuno dei numeri all'interno e sommandolo.
Esempio:
Ecco cosa accadrebbe per un input di 10:
Gamma: [1,2,3,4,5,6,7,8,9,10]
Inverso: [1,2,3,4,5,6,7,8,9,01]
(i numeri di 1 carattere invertiti sono essi stessi, 10 invertiti sono 01 o 1)
Somma: 46
I numeri con più di 3 cifre sono invertiti allo stesso modo dei numeri con 2 cifre. Ad esempio, 1234 diventerebbe 4321.
Casi test:
Input -> Output
10 -> 46
5 -> 15
21 -> 519
58 -> 2350
75 -> 3147
999 -> 454545
I casi di testo completi per l'input di 999 possono essere trovati qui , grazie mille a @ fireflame241.