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

 

tmhscs@gmail.com search > linearSearch_array
prev  |  next  |  chance

Given an integer array and a target value, use the linear search algorithm to return the index of the first time that value appears in the data set. Return -1 if the value does not exist.


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

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

public int linearSearch_array(int[] arr, int value) { }

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