Pass rubocop

This commit is contained in:
Vitor Oliveira 2020-12-20 16:50:42 -08:00
parent 00a3e61cfe
commit e2a03f33c4

View file

@ -5,18 +5,15 @@ def double_linear_search(array, search_item)
end_ind = array.length - 1
while start_ind <= end_ind
if array[start_ind] == search_item
return start_ind
elsif array[end_ind] == search_item
return end_ind
else
return start_ind if array[start_ind] == search_item
return end_ind if array[end_ind] == search_item
start_ind += 1
end_ind -= 1
end
end
# returns -1 if search_item is not found in array
return -1
-1
end
puts(double_linear_search([1, 5, 5, 10], 1))