X1521: Linear Search Starting at

Complete the following linear search method. Find the the number lookFor in the array numbers, but start searching at position startAt. If the number is found, return the index for the position. If the number is not found, return -1.

You can assume that startAt is within the valid boundaries of the size of numbers.

Examples:

linearSearch({9,2,2,3,4},2,0) -> 1
linearSearch({9,2,2,3,4},2,2) -> 2
linearSearch({9,2,2,3,4},2,3) -> -1

Your Answer:

Feedback

Your feedback will appear here when you check your answer.