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

 

apcsaListFindOutOfOrder


Given an ArrayList of String values, find and return the index of the first String value which is lexicographically before the previous element in the list. Return -1 if the list is already sorted in nondescending order, which is what most sorting algorithms will produce.


HINT: how do we compare String values again?

apcsaListFindOutOfOrder(["a", "b", "a"]) → 2
apcsaListFindOutOfOrder(["a", "b", "c"]) → -1
apcsaListFindOutOfOrder(["find", "me", "something", "good", "today"]) → 3

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

public int apcsaListFindOutOfOrder(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: 230

Copyright Nick Parlante 2017 - privacy