Skip to content

Commit e6687a6

Browse files
authored
Create Reverse Degree of a String.java
1 parent 0343dfd commit e6687a6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Easy/Reverse Degree of a String.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public int reverseDegree(String s) {
3+
int result = 0;
4+
for (int i = 0; i < s.length(); i++) {
5+
result += (i + 1) * (26 - (s.charAt(i) - 'a'));
6+
}
7+
return result;
8+
}
9+
}

0 commit comments

Comments
 (0)