Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (javk):

Java - Can somebody help me do this...

OpenStudy (javk):

OpenStudy (javk):

``` public class q { public static boolean thereExists(char a, String s) { if (s.indexOf(a)>=0) return true; else return false; } public static String isPermutation(String s, String t) { String affirmative = "No"; int charExists = 0; char [] a = new char[s.length()]; char [] b = new char[t.length()]; for(int i=0; i<s.length() && s.length()==t.length(); i++) { a[i]= s.charAt(i); if (thereExists(a[i], t) && thereExists(b[i], s)==true) charExists += 1; if (charExists == s.length()) affirmative = "Yes"; } return affirmative; } public static void main(String [] args) { System.out.println(isPermutation(args[0], args[1])); } }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!