finish extra/en-route-salute

Submitting solution...
Submission: SUCCESSFUL. Completed in: 7 mins, 15 secs.
This commit is contained in:
Seongbeom Park 2022-05-08 03:21:16 +09:00
parent 50a826ffa8
commit ae493f3a8a
2 changed files with 22 additions and 0 deletions

View File

@ -82,3 +82,6 @@ CFcSBwgCCBoHRhkKU1cGAA4AGU5YQR5THBwNFwoGGAxTQQMQVBUSBg4EAAwQRhUQVBUHFAQTGRpT QQM
### ion-flux-relabeling
* Completed in: 9 hrs, 33 mins, 36 secs.
### en-route-salute
* Completed in: 7 mins, 15 secs.

View File

@ -0,0 +1,19 @@
def solution(s):
result = 0
count = 0
for c in s:
if c == '>':
count += 1
if c == '<':
result += count
return 2 * result
tests = [
(">----<", 2),
("<<>><", 4),
("--->-><-><-->-", 10),
]
for i, o in tests:
result = solution(i)
print (i, result == o, result, o)