Skip to content

Commit 1b8f6dc

Browse files
add 3110
1 parent e745492 commit 1b8f6dc

File tree

2 files changed

+16
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+16
-0
lines changed

paginated_contents/algorithms/4th_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
| 3131 | [Find the Integer Added to Array I](https://leetcode.com/problems/find-the-integer-added-to-array-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3131.java) | | Easy |
2727
| 3127 | [Make a Square with the Same Color](https://leetcode.com/problems/make-a-square-with-the-same-color/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3127.java) | | Easy |
2828
| 3120 | [Count the Number of Special Characters I](https://leetcode.com/problems/count-the-number-of-special-characters-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3120.java) | | Easy |
29+
| 3110 | [Score of a String](https://leetcode.com/problems/score-of-a-string/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3110.java) | | Easy |
2930
| 3046 | [Split the Array](https://leetcode.com/problems/split-the-array/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3046.java) | | Easy |
3031
| 3042 | [Count Prefix and Suffix Pairs I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3042.java) | | Easy |
3132
| 3038 | [Maximum Number of Operations With the Same Score I](https://leetcode.com/problems/maximum-number-of-operations-with-the-same-score-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3038.java) | | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3110 {
4+
public static class Solution1 {
5+
public int scoreOfString(String s) {
6+
int score = 0;
7+
for (int i = 0; i < s.length() - 1; i++) {
8+
int asciiVal1 = s.charAt(i);
9+
int asciiVal2 = s.charAt(i + 1);
10+
score += Math.abs(asciiVal1 - asciiVal2);
11+
}
12+
return score;
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)