Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は2つのスタックで知っています.しかし、1つでどうですか?
再帰関数呼び出しを使用してスタックをポップすることで「チート」できます。次に、キューに入れられているアイテムをプッシュし、再帰呼び出しが巻き戻されるときに、ポップされたものをプッシュします。ただし、システムプログラムカウンターはスタックであるため、これは実際には2つのスタックです。