Write a program to get the number of words possible using an alphabets array. All the vowels
in the array should be together.
There could be duplicate alphabets.
Input(char Array) | Output |
---|---|
{ 'a', 'a', 'a', 'a', 'a', 'b', 'b', 't', 't' } | 30 |
{ 'a', 'e', 'r', 'o', 'p', 'l', 'a', 'n', 'e'} | 3600 |
{ 'a', 'a', 'a', 'e', 'e', 'e', 'i', 'i', 'o', 'o', 'u'} | 277200 |
{ 'u', 'u, 'u' 'u', 'u' } | 1 |
{ 't', 't', 't', 't', 't' } | 1 |
{ 'a', 'p', 'p', 'l', 'e'} | 24 |
{}(EMPTY ARRAY) | 1 |
class CombinationsWithVowelsTogetherHavingDuplicates
{ public static void main(String s[])
{
char array[] = {
'a',
'p',
'p',
'l',
'e'};
System.out.println("The Count of combinations: " + getCombinations(array));
}
public static int getCombinations(char array[])
{
//Write a code here to get the number of words possible using an alphabets array. If required, you can use getFactorial and isVowel methods.
}
public static int getFactorial(int number)
{
//Write a code here to get the factorial of a given number and return it.
}
public static boolean isVowel(char ch)
{
//Write a code here the given character is vowel or not and return it.
}
}
Topic: Learn Arrays And Loops