Write a program to get the number of words possible using an alphabets array.
All the vowels in the array should be together.
Input(char Array) | Output |
---|---|
{ 'f', 'r', 'i', 'e', 'n', 'd', 's' } | 1440 |
{ 'r', 'a', 'i', 'n', 'b', 'o', 'w' } | 720 |
{ 'a', 'e, 'i' 'o', 'u' } | 120 |
{ 'a', 'b, 'c' 'e', 'o', 'd' } | 144 |
{ 'n', 'e', 'w', 's' } | 24 |
{ 's', 'u', 'n', 'f', 'l', 'o', 'w', 'e', 'r' } | 362880 |
{}(EMPTY ARRAY) | 1 |
class CombinationsWithVowels
{ public static void main(String s[])
{
char inputArray[] = {
'r',
'a',
'i',
'n',
'b',
'o',
'w'};
System.out.println("The number of combinations with vowels together and without duplicates are : " + getCombinations(inputArray));
}
public static int getCombinations(char[] array)
{
//Write a code here to get the number of words possible using an alphabets array and return result.If required, you can use getFactorial method.
}
public static int getFactorial(int number)
{
//Write a code here to get the factorial of a given number and return it.
}
}
Topic: Learn Arrays And Loops