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 end_ind = array.length - 1
while start_ind <= end_ind while start_ind <= end_ind
if array[start_ind] == search_item return start_ind if array[start_ind] == search_item
return start_ind return end_ind if array[end_ind] == search_item
elsif array[end_ind] == search_item
return end_ind start_ind += 1
else end_ind -= 1
start_ind += 1
end_ind -= 1
end
end end
# returns -1 if search_item is not found in array # returns -1 if search_item is not found in array
return -1 -1
end end
puts(double_linear_search([1, 5, 5, 10], 1)) puts(double_linear_search([1, 5, 5, 10], 1))