Java Array Answer


#1

public class Solution {
public int solve(String A) {
String a = A.toLowerCase();

    int count=0;
    for(int i=0;i<a.length();i++){
        if(a.charAt(i)=='a' || a.charAt(i)=='e' || a.charAt(i)=='i' || a.charAt(i)=='o' || a.charAt(i)=='u')
        {
            count++;
          
            for(int j=i+1;j<a.length();j++){
                count++;
            
            }
        }
    }
    int N = count % 10003;
    return N;
}

}


#2

Why count%10003???


#3

dont run a loop for counting all the subsequences, instead just do count = count+A.length()-1 and it will run smoothly.