<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ~~~ import java.util.Stack; /** * 用兩個棧實現隊列 */ public class Algorithm01 { public static void main(String arg[]) { StackQueue queue = new StackQueue(); queue.add(10); queue.add(12); queue.add(1); queue.add(3); Integer result = null; while ((result = queue.poll()) != null) { System.out.println(result); } } } // 用棧實現隊列 class StackQueue { private Stack<Integer> pushStack = new Stack<>(); private Stack<Integer> popStack = new Stack<>(); private void pushToPopStack() { if (popStack.isEmpty()) { while (!pushStack.empty()) { popStack.push(pushStack.pop()); } } } public void add(Integer num) { if (num == null) { throw new RuntimeException("num is null"); } pushStack.push(num); pushToPopStack(); } public Integer poll() { if (pushStack.isEmpty() && popStack.isEmpty()) { throw new RuntimeException("stack is empty"); } pushToPopStack(); return popStack.pop(); } public Integer peek() { if (pushStack.isEmpty() && popStack.isEmpty()) { throw new RuntimeException("stack is empty"); } pushToPopStack(); return popStack.pop(); } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看