Find if a word in the character arrays are jumble word of the other.
Input (Char Array1, Array2) | Output |
---|---|
{ 'h', 'e', 'l', 'p' }, {'h', 'e', 'l', 'p'} | true |
{ 'n', 'e', 'w', 's' }, {'s', 'w', 'e', 'n'} | true |
{ 'h', 'e', 'a', 't' }, {'h', 'a', 't', 'e'} | true |
{ 't', 'a', 's', 'p' }, { 'v', 'b', 'r', 'n' } | false |
{ 'p', 'e', 'n', 's'}, { 'o', 'f', 'm', 't'} | false |
class IsJumbled
{ public static void main(String s[])
{
char inputArray1[] = {'h', 'e', 'a', 't'};
char inputArray2[] = {'h', 'a', 't', 'e'};
System.out.println("Is \"heat\" a jumble of \"hate\" : " + isJumbled(inputArray1, inputArray2));
}
public static boolean isJumbled(char array1[], char array2[]) {
//Write a code here to check the words are jumble of each other or not and return it.
}
}
Topic: Learn Arrays And Loops