We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 47804c7 commit 71a7f0cCopy full SHA for 71a7f0c
1 file changed
live9/test93/문제2/백유진.py
@@ -1,17 +1,16 @@
1
def solution(name):
2
answer = 0
3
4
+ min_cursor = len(name) - 1
5
6
for idx, alphabet in enumerate(name):
7
answer += min(ord(alphabet) - 65, 91 - ord(alphabet))
- print(ord(alphabet) - 65)
8
- print(91 - ord(alphabet))
9
10
end = idx+1
11
while end < len(name) and name[end] == 'A':
12
end += 1
13
- print(idx+1, end)
+ min_cursor = min(min_cursor, idx*2 + len(name)-end, (len(name)-end)*2 + idx)
14
15
- answer += min(end-(idx+1), )
16
-
+ answer += min_cursor
+
17
return answer
0 commit comments