Created
October 18, 2017 20:27
-
-
Save songz/a6192deb4b03e10de5628b69b8fd64dd to your computer and use it in GitHub Desktop.
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
const isInterval = (input, ival, i=0) => { | |
if(i===input.length) return false; | |
const curInt = input[i]; | |
if(ival[0] > curInt[0] && ival[0] < curInt[1] | |
|| ival[1]<curInt[1] && ival[1] > curInt[0]) return true; | |
return isInterval(input, ival, i+1); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment