Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Count Redundant Substrings Where Length Equals a*Vowels + b*Consonants

Given a string and two integers a and b, a substring is considered redundant if its length equals a * V + b * C, where V and C are the number of vowels and consonants in the substring respectively. Find the total count of redundant substrings within the given string.

Asked at:

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Late July, 2025

Amazon

Amazon

Senior

An string is defined as redundant if the length of the string, |word| = a * V + b * C, where a and b are given integrers and V and C are the numbers of vowels and consonants in the string word. Given an string, and two integers, a, and b, find the number of redundant substrings of word. Note: A substring is a contiguous group of 0 or more characters in a string. Example: word = "abbacc", a=-1, b=2 The redundant substrings in "abbacc" are shown | Substring | Vowels | Consonants | Length | a * V + b * C | "abb" 1 2 3 -1*1 + 2*2 = 3 "bba" 1 2 3 -1*1 + 2*2 = 3 "bac" 1 2 3 -1*1 + 2*2 = 3 "acc" 1 2 3 -1*1 + 2*2 = 3 "abbacc" 2 4 6 -1*2 + 2*4 = 6 Constraints: 1 <= |word| <= 10^5 -10^3 <= a <= 10^3 -10^3 <= b <= 10^3 word contains lowercase English letters, [a-z]

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.