Challenge: Sequential Search

Let’s learn how to implement the sequential search algorithm.

Problem

Write a method that searches for a given value in an unsorted array.

Input

An integer array and a key.

Output

Return true if the key is found, false otherwise.

Sample input

array = { 1,2,3,4,5,8,7,6 }
key = 3

Sample output

true

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.