HELP IN JAVA!! URGENT

Posted by annayena on Stack Overflow See other posts from Stack Overflow or by annayena
Published on 2010-06-07T09:49:48Z Indexed on 2010/06/07 9:52 UTC
Read the original article Hit count: 122

Filed under:

The following function accepts 2 strings, the 2nd (not 1st) possibly containing *'s (asterisks). An * is a replacement for a string (empty, 1 char or more), it can appear appear (only in s2) once, twice, more or not at all, it cannot be adjacent to another * (ab**c), no need to check that.

public static boolean samePattern(String s1, String s2)

It returns true if strings are of the same pattern. It must be recursive, not use any loops, static & global variables. Also it's PROHIBITED to use the method equals in the String class. Can use local variables & method overloading. Can use only these methods: charAt(i), substring(i), substring(i, j), length().

Examples:

1: TheExamIsEasy; 2: "The*xamIs*y" ---> true 1: TheExamIsEasy; 2: "Th*mIsEasy*" ---> true 1: TheExamIsEasy; 2: "*" ---> true 1: TheExamIsEasy; 2: "TheExamIsEasy" ---> true 1: TheExamIsEasy; 2: "The*IsHard" ---> FALSE

I am stucked on this question for many hours now! I need the solution in Java please kindly help me.

© Stack Overflow or respective owner

Related posts about javadoc