https://www.hackerrank.com/challenges/string-construction/problem?isFullScreen=true
String Construction | HackerRank
Find the minimum cost of copying string s.
www.hackerrank.com
1. 한 글자당 프린트 가격은 1원이다.
2. 이미 프린트 된 글자는 가격 소모 없이 재입력 가능하다.
def stringConstruction(s):
spel_list = []
for spel in s:
if spel not in spel_list: #리스트에 없으면 추가
spel_list.append(spel)
else:
pass
return len(spel_list) #글자당 1원임으로
'파이썬 코딩테스트 > 해커랭크' 카테고리의 다른 글
HackerRank / Palindrome Index / Python (0) | 2021.12.30 |
---|---|
HackerRank / Sherlock and the Valid String / Python (0) | 2021.12.28 |
HackerRank / The Love-Letter Mystery / Python (0) | 2021.12.26 |
HackerRank / Missing Number / Python (0) | 2021.12.26 |
HackerRank / Smart Number / Python (0) | 2021.12.26 |