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

 

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

Write a method that returns the position in the string (with the first character being at position 0) of the LAST occurrence of 'ltr'. Look at the test data for examples. The only string methods you are allowed to use are .equals, .length, .substring, and .charAt.


nov20_2015_APSLHL_lastOne("this is a smooth test", "s") → 19
nov20_2015_APSLHL_lastOne("abxcdxxxfhjilkxmx", "x") → 16
nov20_2015_APSLHL_lastOne("abxcdxxxfhjilkxmx", "a") → 0

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

public int nov20_2015_APSLHL_lastOne(String str, char ltr) { }

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