#3498

Reverse Degree of a String

newbie · 100 · lc easy +12 · 88.6% accepted · 84 likes · top 99%

Description

Compute the "reverse degree" of string s:

- Assign each character a reverse-alphabet value: \'a\' = 26, \'b\' = 25, ..., \'z\' = 1.

- Multiply each character\'s reverse-alphabet value by its 1-indexed position in s.

- Sum all those products.

Return the result.

Code

1
2
3