Home  >  Article  >  Backend Development  >  javascript - 查询2个数是否在两个数区间内 js php java c# golang

javascript - 查询2个数是否在两个数区间内 js php java c# golang

WBOY
WBOYOriginal
2016-06-06 20:14:531366browse

需求

查询2个数是否在两个数区间内

数据

有两个数 A = 12B = 15

有 一组数组

<code>var  Arr = [[11,12],[12,15],[15,17]];</code>

算法

AB 是否在 数组 Arr[0] 的 两个数字区间内

错误 ❌ demo

<code>
if(A > Arr[0][0] && A  Arr[0][0] && B </code>

Help

求 js ,php,java,C# ,Golang ,算法实现,希望各大神能写出性能 最高的算法!!!

大神在哪里呀

回复内容:

需求

查询2个数是否在两个数区间内

数据

有两个数 A = 12B = 15

有 一组数组

<code>var  Arr = [[11,12],[12,15],[15,17]];</code>

算法

AB 是否在 数组 Arr[0] 的 两个数字区间内

错误 ❌ demo

<code>
if(A > Arr[0][0] && A  Arr[0][0] && B </code>

Help

求 js ,php,java,C# ,Golang ,算法实现,希望各大神能写出性能 最高的算法!!!

大神在哪里呀

<code>((A >= Arr[0][0] && A = Arr[0][0] && B </code>

<code>if A>B:
    return self.compare(B,A)
return A>Arr[0][0] and B<arr></arr></code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn