Vowel and Consonant Substrings | InterviewBit | Solution
class Solution: def solve(self, A): vowels = ['a', 'e', 'i', 'o', 'u'] data = {'c': 0, 'v': 0} ans = 0 for c in A: if c in vowels: ans += data['c'] data['v'] += 1 else: ans += data['v'] data['c'] += 1 ans = ans % (10**9 + 7) return (ans % (10**9 + 7))
Recommended Posts
Gas Station | InterviewBit | Solution Explained
June 13, 2022
Majority Element | InterviewBit | Solution Explained
June 13, 2022
Please write the proof.
This solution need an amendment for 2 digit number.
Please write a Proof for this