Skip to content

Commit 7e037f5

Browse files
committed
3110. Score of a String
1 parent 5ea87b1 commit 7e037f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

3110. Score of a String/main.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
object Solution {
2+
def scoreOfString(s: String): Int = {
3+
var sum: Int = 0
4+
for (i <- 1 to s.length-1) {
5+
sum += (s.charAt(i-1) - s.charAt(i)).abs
6+
}
7+
return sum
8+
}
9+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy