Your task is to complete a function GetArrangements() that returns the count of all the possible arrangements of length N that can be derived from the characters of an input string of length N. The input string may or may not have repeated characters.
Your task is to complete a function GetArrangements() that returns the count of all the possible arrangements of length N that can be derived from the characters of an input string of length N. The input string may or may not have repeated characters. Your function should handle all the possible cases.
For example,
for the input provided as follows:
ABCB
The function should return
12
Explanation:
For input string, “ABCB” whose length is 4, the possible sub-strings of length 4 are ABCB, ACBB, ABBC, BBAC, BABC, BACB, CBAB, CABB, CBBA, BBCA, BCBA and BCAB. Therefore your function should return 12 for this input string
Another example,
for the input provided as follows:
ABC
The function should return
6
#include<stdio.h>
#include <string.h>
int GetArrangements(char s[])
{
int output=-1;
return output;
}
int main()
{
char s[100];
gets(s);
//write your code here
printf("%d",GetArrangements(s));
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images