题解 | #扑克牌顺子#
扑克牌顺子
http://www.nowcoder.com/practice/762836f4d43d43ca9deb273b3de8e1f4
{
let numberList = numbers.filter(item=> {return item}) // 获取非0数组
let map = Array.from(new Set(numberList)) // 上面去重
if(map.length < numberList.length){
return false // 一定false的情况
}
let gap = Math.max(...numberList) - Math.min(...numberList)
return gap <= 4 // 最大最小差4以内就可以
// write code here
}
module.exports = {
IsContinuous : IsContinuous
};