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

 

abraskin@mbusd.org > bestLoner
prev  |  next  |  chance

Given an array of ints, the best one is the one that has the greatest difference from its following neighbor.
Note that this means that the last element can never be the greatest.
Return the index of the best int.


bestLoner([1, 2, 5, 3, 2, 1]) → 1
bestLoner([9, 2, 3, 4, 3, 4, 5, 2]) → 0
bestLoner([2, 2, 3, 4, 3, 4, 5, 9]) → 6

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

public int bestLoner(int[] arr) { }

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

Copyright Nick Parlante 2017 - privacy