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

 

tmhscs@gmail.com arrays > array_nextTrue
prev  |  next  |  chance

Given a boolean array "arr" and an integer "index", return the next index that has a value of true in the array. If you reach the end of the array, wrap around to the start!


array_nextTrue([true, true, true], 0) → 1
array_nextTrue([true, true, true], 1) → 2
array_nextTrue([true, true, true], 2) → 0

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

public int array_nextTrue(boolean[] arr, int index) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy