摘要:
自己写的: 类似用两个栈实现队列的那道题,只要简单的转换一下思路,在脑子里模拟一下用两个队列配合表现出一个栈的功能。 from collections import deque class MyStack: def __init__(self): # 两个队列,相当于两个篮子 self.deque1 阅读全文
posted @ 2025-03-02 22:49
axuu
阅读(23)
评论(0)
推荐(0)
摘要:
232. 用栈实现队列 - 力扣(LeetCode) 代码随想录 (programmercarl.com) 思想:用下面的两个栈模拟队列 from collections import deque class MyQueue: def __init__(self): # in主要负责push,out 阅读全文
posted @ 2025-03-02 14:39
axuu
阅读(10)
评论(0)
推荐(0)
浙公网安备 33010602011771号