The following list is a Stack. Solve the following problem:AABBCDAPop()Pop()Push(A)Push(E)Pop()Push(D)Pop()Push(A)
AABBCDA
AABBCD Pop()
AABBC Pop()
AABBCA Push(A)
AABBCAE Push(E)
AABBCA Pop()
AABBCAD Push(D)
AABBCA Pop()
AABBCAA Push(A)
ans: AABBCAA, assume the top is end of the list
Jasmine Cui:
AABBCDA
=ABBCDA
=BBCDA
=ABBCDA
=EABBCDA
=ABBCDA
=DABBCDA
=ABBCDA
=AABBCDA
AABBCDA
ABBCDA
ABBCDA
BBCDA
ABBCDA
EABBCDA
ABBCDA
DABBCDA
ans, ABBCDA
ABBCDA
BBCDA
ABBCDA
EABBCDA
ABBCDA
DABBCDA
ans, ABBCDA
ABBCDA BBCDA ABBCDA EABBCDA ABBCDA DABBCDA ABBCDA ABBCDA ANS : ABBCDA
ABBCDA
Pop(): ABBCDA
Pop(): BBCDA
Push(A): ABBCDA
Push(E): EABBCDA
Pop(): ABBCDA
Push(D): DABBCDA
Pop(): ABBCDA
Push(A): AABBCDA
Kimi Chen
ABBCDA
BBCDA
ABBCDA
EABBCDA
ABBCDA
DABBCDA
ABBCDA
ABBCDA
ANS : ABBCDA