Java - Can somebody help me do this...
``` 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])); } }
Join our real-time social learning platform and learn together with your friends!