|
|
back to boardThe answer to the problem we can easily design 1000 stacks using a linked list,every node we 'll use a int to store its data,another int to store its father's index,we'll use 8 byte each node, about 800K,that will get MLE. Then we can see the index of a node's father will always <=100000,we can just use 17 bit to store it,instead of a int(32 bit),zipped it and get AC~ :) Re: The answer to the problem The problem can be solved much easier using only 101000 ints =) And complexity of the algo is about O (N logN) |
|
|