Skip to content

Commit 7273132

Browse files
committed
update
1 parent 6aede65 commit 7273132

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Runtime 1 ms Beats 100.00%
2+
// Memory 42.92 MB Beats 46.96%
3+
// .
4+
// T:O(n), S:O(1)
5+
//
6+
class Solution {
7+
public int reverseDegree(String s) {
8+
int ret = 0;
9+
for (int i = 0; i < s.length(); i++) {
10+
char c = s.charAt(i);
11+
ret += (26 - (int) (c - 'a')) * (i + 1);
12+
}
13+
14+
return ret;
15+
}
16+
}

0 commit comments

Comments
 (0)