본문 바로가기
python-algorithm

leetcode 3330. Find the Original Typed String I

by 무적김두칠 2024. 10. 27.

https://leetcode.com/problems/find-the-original-typed-string-i/description/

 

1
2
3
4
5
6
7
8
9
10
11
class Solution:
    def possibleStringCount(self, word: str-> int:
        answer = 1
        current_alphabet = word[0]
        for i in range(1len(word)):
            if word[i] == word[i - 1]:
                answer += 1                
            else:                
                current_alphabet = word[i]
        
        return answer
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 32498 Call for Problems  (0) 2024.11.27
백준 32384 사랑은 고려대입니다  (0) 2024.11.27
백준 32260 A + B  (0) 2024.10.27
백준 32154 SUAPC 2024 Winter  (1) 2024.10.27
3300. Minimum Element After Replacement With Digit Sum  (0) 2024.10.05

댓글