-
-
Save dean-gr/1e6ff0bf9090f4d8043e to your computer and use it in GitHub Desktop.
Check if given input is continuous based on a given range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set_range = (0..6).to_a | |
a = (1..3).to_a | |
b = [1, 3, 4] | |
def continous?(input, set_range) | |
range.each_cons(input.count) do |c| | |
p c == input | |
end | |
continous?(range, a) #=> should return true | |
continous?(range, b) #=> should return false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment