You are viewing a single comment's thread. Return to all comments →
Python full_repeats = n // len(s) remainder = n % len(s) a_count = s.count('a') total_a_count = full_repeats * a_count total_a_count += s[:remainder].count('a') return total_a_count `
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Repeated String
You are viewing a single comment's thread. Return to all comments →
Python full_repeats = n // len(s) remainder = n % len(s) a_count = s.count('a') total_a_count = full_repeats * a_count total_a_count += s[:remainder].count('a') return total_a_count `