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

 

orion.a.smith@gmail.com apcsa-lists > apcsaListFindLastNeighbors
prev  |  next  |  chance

Given an ArrayList of Integers, return the index of the LAST element whose value is identical to the value after it. Return -1 if no elements of the list are equal to their neighbors.


apcsaListFindLastNeighbors([3, 4, 4, 3]) → 1
apcsaListFindLastNeighbors([1, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9]) → 8
apcsaListFindLastNeighbors([1, 2, 3, 4, 5, 6, 7, 8, 9]) → -1

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

public int apcsaListFindLastNeighbors(ArrayList<Integer> 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: 220

Copyright Nick Parlante 2017 - privacy