about | help | code help+videos | done | prefs |
Write a method that accepts a string of characters called 'str'. As a pre-condition, you may assume that this string will ONLY contain lower-case letters 'a' through 'z' and possibly spaces. Your goal is to determine which letters appear more than once in the string (ignore spaces). So you will return a string, in alphabetical order, of the letters that appear more than once in 'str'. Look at the test data for examples. The only string methods you are allowed to use are: .equals, .length, .substring, .charAt, and .compareTo. You are NOT allowed to use any libraries or library methods. You would benefit greatly by thinking about this FIRST before you start coding. I solved it in 9 lines of code (not counting the header or lines with just braces), so it doesn't have to be super difficult. nov21_2019_HL_duplicateChars("i should have made a harder problem for hl") → "adehlmor" nov21_2019_HL_duplicateChars("this one does not even require recursion") → "einorstu" nov21_2019_HL_duplicateChars("much less backtrack recursion") → "acekrsu" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy