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

 

orion.a.smith@gmail.com apcsa-comparestrings > apcsaStringCompareFirstSubstring
prev  |  next  |  chance

Given an ArrayList of String values all with at least two characters, examine the substring of each String starting with index 1 (second character) to the end. Find and return the original String value, the substring of which is "less than" all the other substrings, as determined by using the compareTo method of the String class. Preconditions: lst contains at least one String, all String values have length() > 1, and no two String values will differ only in the first character. This method is similar to the last one, with the addition of the substring component.


apcsaStringCompareFirstSubstring(["cbc", "ecd", "azz"]) → "cbc"
apcsaStringCompareFirstSubstring(["12", "23", "31", "32"]) → "31"
apcsaStringCompareFirstSubstring(["aApple", "bapple"]) → "aApple"

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

public String apcsaStringCompareFirstSubstring(ArrayList<String> lst) { }

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: 240

Copyright Nick Parlante 2017 - privacy