Implement linearSearch(arr, target) that returns the index of the first occurrence of target in arr. If target is not present, return -1.
Input
arr: an array of values
target: the value to find
Output
The index of the first match, or -1 if target is not in arr.
Examples
Example 1
Inputarr = [1, 2, 3, 4, 5], target = "hello"
Output-1
Example 2
Inputarr = [10, 20], target = "a"
Output-1
Constraints
Scan elements left to right; return as soon as a match is found.
Return -1 if no element equals target.