I have solved this problem but it is exceeding time limit


#1

Comment body goes here.`public class Solution {
int possiblePer(char c , int N){
if(N == 0)
return 1;

            if(c  == 'a')
                return possiblePer('e' , N-1)+ possiblePer('i' , N-1);
            if(c == 'e')
                return possiblePer('i' , N-1);
            if(c == 'i')
                 return possiblePer('a' , N-1)+ possiblePer('e' , N-1)+ possiblePer('u' , N-1) + possiblePer('o' , N-1);
            if(c == 'o')
                 return possiblePer('a' , N-1)+ possiblePer('u' , N-1);
            if(c == 'u')
                return possiblePer('o' , N-1)+possiblePer('e' , N-1);
            
         return 0;
    
}
public int solve(int A) {
    int count =0;
    char vowels[] = {'a' , 'e' , 'i' , 'o' , 'u'};
    for(char c : vowels){
        count += possiblePer(c , A-1);
    }
    return count;
}

} `