0
/ 40
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the string found....
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the string found. If it is not found, return null
. 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") -> "Charlotte"
linearSearch({"Charlotte", "Raleigh", "Greensboro"},"Durham") -> null
Your feedback will appear here when you check your answer.