Description
Solutions
Get Redundant Substrings
🔥 FULLTIME

Data analysts at Amazon are building a utility to identify redundant words in advertisements.

They define a string as redundant if the length of the string, |word| = a * V + b * C, where a and b are given integers and V and C are the numbers of vowels and consonants in the string word.

Given a string word, 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. For example- "bcb" is a substring of "abcba", while "bba" is not.

Function Description

Complete the function getRedundantSubstrings in the editor below.

Returns

int: the number of redundant substrings

Example 1:

Input:  word = "abbacc", a = -1, b = 2
Output: 5
Explanation:
There are 5 redundant substrings.

Example 2:

Input:  word = "akljfs", a = -2, b = 1
Output: 15
Explanation:
N/A for now...Will add once fint it :) Or if you happen to know about it, feel free to lmk! Manyyy thanks in advance! 😘
Constraints:
    1. 1 ≤ |word| ≤ 10^5
    2. -10^3 ≤ a ≤ 10^3
    3. -10^3 ≤ b ≤ 10^3
    4. word contains lowercase English letters, [a-z].
Thumbnail 0
Testcase

Result
Case 1

input:

output: