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

 

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

Given a boolean array "arr", return the index of the first true value in the array. Return -1 if you find no values of true.


array_firstTrue([]) → -1
array_firstTrue([true]) → 0
array_firstTrue([false, true]) → 1

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

public int array_firstTrue(boolean[] 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

Post-solution available

Copyright Nick Parlante 2017 - privacy