0
/ 40
Complete the following linear search method. Find the string search in the array words. If the string is found, return the index for the...
Complete the following linear search method. Find the string search in the array words. If the string is found, return the index for the position. If it is not found, return -1. It is unspecified if the array is ordered or not, so assume it is not. The comparison should be case insensitive (i.e., look up equalsIgnoreCase()).
Examples:
linearSearch({"Charlotte", "Raleigh", "Greensboro"},"Charlotte") -> 0
linearSearch({"Charlotte", "Raleigh", "Greensboro"},"Durham") -> -1
linearSearch({"Charlotte", "Raleigh", "Greensboro"},"GREENSBORO") -> 2
Your feedback will appear here when you check your answer.