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

 

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

Write a method that returns the first part of a string up to the first duplicate character (a duplicate character is when two identical characters are right in a row). Look at the test data for examples. The only string methods you may use are .length, .charAt, .substring, and .equals. As a precondition, you may assume that the input parameter has at least one character.


nov18_2016_APSLHL_upToDuplicate("dropping") → "drop"
nov18_2016_APSLHL_upToDuplicate("continue until duplicate") → "continue until duplicate"
nov18_2016_APSLHL_upToDuplicate("bookkeeper") → "bo"

...Save, Compile, Run (ctrl-enter)

public String nov18_2016_APSLHL_upToDuplicate(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