由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - hasNext的迭代器题怎么做?
相关主题
zynga, linkedin, epic, two sigma, facebook面经Design Pattern Question - Decorator
Two problems from Google一道design pattern的问题
面完G的电面了,忐忑说说Decorator那个题
iterator 实现 如何 peek(),pop()?Google店面
新鲜G面经google on campus 面试多久出结果+面经
请教 Iterator 一题面经&感想
实现vector的iterator,template问题aixiang面经疑云重重
面试题:GetNumber and ReleaseNumber[google面试]iterator访问
相关话题的讨论汇总
话题: hasnext话题: 器题话题: 迭代话题: peek话题: class
进入JobHunting版参与讨论
1 (共1页)
K*******i
发帖数: 399
1
我已经是第N次在不同的面经里看到这道题出现了。
这题到底想考察什么(设计模式还是算法?),有什么trick?
template class iterator {
bool hasNext();
T next();
}
现在要写一个decorator(wrapper),里面有一个T peek()函数,它返回的是当前指向的
数据,如果反复call它,它应该回复一样的数(如果call next()再用peek(),返
回的就是下一个数据)
f*******n
发帖数: 12623
2
just look 1 element ahead and remember it
1 (共1页)
进入JobHunting版参与讨论
相关主题
[google面试]iterator访问新鲜G面经
Google onsite归来请教 Iterator 一题
问道G 的题实现vector的iterator,template问题
讨论一个题目面试题:GetNumber and ReleaseNumber
zynga, linkedin, epic, two sigma, facebook面经Design Pattern Question - Decorator
Two problems from Google一道design pattern的问题
面完G的电面了,忐忑说说Decorator那个题
iterator 实现 如何 peek(),pop()?Google店面
相关话题的讨论汇总
话题: hasnext话题: 器题话题: 迭代话题: peek话题: class