二爷的那个Longest Consecutive Sequence的新解法?# JobHunting - 待字闺中
c*r
1 楼
请问二爷,getCount中,hs.remove(v)的目的是什么呢?减小hashset,提高
performance吗?多谢~
int getCount(Set hs, int v, boolean asc){
int count=0;
while(hs.contains(v)){
hs.remove(v);
count++;
if(asc) v++; else v--;
}
return count;
}
performance吗?多谢~
int getCount(Set
int count=0;
while(hs.contains(v)){
hs.remove(v);
count++;
if(asc) v++; else v--;
}
return count;
}