From 8979d2ef7064316959f3ec3eee1060709425341b Mon Sep 17 00:00:00 2001 From: rimogsu Date: Wed, 19 Aug 2026 21:22:41 +0900 Subject: [PATCH] 3813 --- .../v2/3813. Vowel-Consonant Score.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v2/3813. Vowel-Consonant Score.py" diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3813. Vowel-Consonant Score.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3813. Vowel-Consonant Score.py" new file mode 100644 index 00000000..9a66eae3 --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3813. Vowel-Consonant Score.py" @@ -0,0 +1,28 @@ +''' +1. 아이디어 : +vowels와 consonants를 각각 count하고, v/c를 return. c가 0이면 0 return. + +2. 시간복잡도 : +o(n * 26) = o(n) + +3. 자료구조/알고리즘 : +''' +from math import floor +class Solution: + def vowelConsonantScore(self, s: str) -> int: + vowels = 'aeiou' + consonants = 'bcdfghjklmnpqrstvwxyz' + + v = 0 + c = 0 + + for i in s: + if i in vowels: + v += 1 + elif i in consonants: + c += 1 + + try: + return floor(v/c) + except: + return 0 \ No newline at end of file