Python3 ||  iteration      || T/S: 99% / 90%
https://leetcode.com/problems/reverse-degree-of-a-string/submissions/1590244511/I could be wrong, but I think that time complexity is O(N) and space complexity
```python3 []
class Solution:
    def reverseDegree(self, s: str) -> int:

        ans, idx = 0, 1
        for ch in s:
            ans+= (123 - ord(ch)) * idx
            idx+= 1

        return ans    
```
```cpp []
class Solution {
public:
    int reverseDegree(const std::string& s) {
        int ans = 0, idx = 1;
        for (char ch : s) {
            ans += (123 - static_cast<int>(ch)) * idx;
            idx++;}
        return ans;}
};
```
```java []
class Solution {
    public int reverseDegree(String s) {
        int ans = 0, idx = 1;
        for (char ch : s.toCharArray()) {
            ans += (123 - (int) ch) * idx;
            idx++;}
        return ans;}
}
```
[https://leetcode.com/problems/reverse-degree-of-a-string/submissions/1590244511/](https://leetcode.com/problems/reverse-degree-of-a-string/submissions/1590244511/)


I could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(1), in which *N* ~ `len(s)`.
['C++', 'Java', 'Python3']