id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > nov21_2019_HL_duplicateChars
prev  |  next  |  chance

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)

public String nov21_2019_HL_duplicateChars(String str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy