Write a method which takes in a string and returns true if the string contains any letters
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a method which takes in a string and returns true if the string contains any letters twice. For example if passed "Apple" it would return true because 'P' is in there twice. Likewise if passed 'sausage' it would return true because 'S' is in there twice. If passed "final" it would return false. Suggestions: Convert the string to an array of characters, sort it then look for adjacent letters that are the same. For Java sorting an array: import.Java.util.Arrays; int[]myArray=new int[] {3,1,2}; Arrays.sort(myArray);
Posted Date: