z**********8 发帖数: 229 | 1 想咨询下,career cup里类似这样的题目:
Imagine a (literal) stack of plates. If the stack gets too high, it might
topple. Therefore,in real life, we would likely start a new stack when the
previous stack exceeds some threshold. Implement a data structure
SetOfStacks that mimics this. SetOf-Stacks should be composed of several
stacks, and should create a new stack once the previous one exceeds capacity
. SetOfStacks.push() and SetOfStacks.pop() should behave identically to a
single stack (that is, pop() should return the same values as it would if
there were just a single stack).
还有什么Towers of Hanoi,一般大公司比如AM这类的,考得多么?感觉这些现场写都
蛮难的啊~~要考虑的东西挺多的(尤指phone interview) |
p*****2 发帖数: 21240 | 2
capacity
这道题感觉好像不算难。用个ArrayList应该就可以了吧。
【在 z**********8 的大作中提到】 : 想咨询下,career cup里类似这样的题目: : Imagine a (literal) stack of plates. If the stack gets too high, it might : topple. Therefore,in real life, we would likely start a new stack when the : previous stack exceeds some threshold. Implement a data structure : SetOfStacks that mimics this. SetOf-Stacks should be composed of several : stacks, and should create a new stack once the previous one exceeds capacity : . SetOfStacks.push() and SetOfStacks.pop() should behave identically to a : single stack (that is, pop() should return the same values as it would if : there were just a single stack). : 还有什么Towers of Hanoi,一般大公司比如AM这类的,考得多么?感觉这些现场写都
|
z**********8 发帖数: 229 | 3 arraylist是不是java自带的?这题用C++怎么做?我在建stack的时候就老说我错误,
好像是指针的问题,还在debug中
【在 p*****2 的大作中提到】 : : capacity : 这道题感觉好像不算难。用个ArrayList应该就可以了吧。
|
l*****a 发帖数: 14598 | 4 arrayList in JAVA equals to vector in c++
【在 z**********8 的大作中提到】 : arraylist是不是java自带的?这题用C++怎么做?我在建stack的时候就老说我错误, : 好像是指针的问题,还在debug中
|
l*********8 发帖数: 4642 | 5 c++里面可以用 stack < stack > |
z**********8 发帖数: 229 | 6 谢谢懂了~
【在 l*********8 的大作中提到】 : c++里面可以用 stack < stack >
|
z**********8 发帖数: 229 | 7 谢谢懂了~
【在 l*****a 的大作中提到】 : arrayList in JAVA equals to vector in c++
|