We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8be683b commit 51bbbdeCopy full SHA for 51bbbde
1 file changed
searches/interpolation_search.rb
@@ -18,7 +18,7 @@ def interpolation_search(array, target)
18
19
value_range = array[right] - array[left]
20
if value_range.zero?
21
- return array[left] == target ? left : -1
+ return -1
22
end
23
24
position = left + ((target - array[left]) * (right - left) / value_range)
0 commit comments