3498. Reverse Degree of a String
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
var reverseDegree = function (s) {
    const reversePosition = (ch) => 26 - (ch.charCodeAt(0) - 'a'.charCodeAt(0))
    let pos = 0
    let sum = 0
    for (let ch of s) {
        pos++
        let rpos = reversePosition(ch)
        sum += rpos * pos
    }
    return sum
};

```
['JavaScript']