摘要:
##232.用栈实现队列 题目|文章 ###1.使用两个栈(修改输出) ####思路 1.使用两个栈,用一个栈输入数据,用另一个栈输出数据 2.当输出栈为空时,将输入栈的数据转移到输出栈中 ####实现 点击查看代码 class MyQueue { public: MyQueue() { } voi 阅读全文
posted @ 2022-10-05 17:30
缩地
阅读(31)
评论(0)
推荐(0)
摘要:
##102.二叉树的层序遍历 题目|文章 ###1.迭代 ####思路 1.创建一个队列 2.确定每一层的节点个数,对每一层进行遍历,将结果输出。 ####实现 点击查看代码 class Solution { public: vector<vector<int>> levelOrder(TreeNo 阅读全文
posted @ 2022-10-05 01:20
缩地
阅读(25)
评论(0)
推荐(0)

浙公网安备 33010602011771号