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

 

orion.a.smith@gmail.com apcsa-loops > apcsaLoopsMaxIndex
prev  |  next  |  chance

Given an input String, find and return the INDEX of the "highest" character in the input (i.e., the character which comes later in an ordering of characters than all others). If there are multiple instances of this highest character, return the lowest index where the character is found. Precondition: str will have at least one character.


See the prior problem apcsaLoopsMaxCharacter for more advice on extracting and comparing String characters.

apcsaLoopsMaxIndex("ab") → 1
apcsaLoopsMaxIndex("Xena") → 2
apcsaLoopsMaxIndex("1234567890") → 8

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

public int apcsaLoopsMaxIndex(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: 210

Copyright Nick Parlante 2017 - privacy