摘要:
##Problem Description Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. class MinStack { public: //Cre 阅读全文
posted @ 2022-03-27 17:03
越菜越自信
阅读(17)
评论(0)
推荐(0)
摘要:
题目描述: 这题表述的很明确了,从最末尾的元素开始输出,这让我们想到的数据结构就是栈了。 思路:先把链表中存储的数据压入栈中,然后弹出到一个动态数组vector中,最后返回数组。 /** * Definition for singly-linked list. * struct ListNode { 阅读全文
posted @ 2022-03-27 10:44
越菜越自信
阅读(20)
评论(0)
推荐(0)
摘要:
##vector is a dynamic array When we want to use vector,we should write this #include We can add and delete element at the tail of vector by using func 阅读全文
posted @ 2022-03-27 00:30
越菜越自信
阅读(23)
评论(0)
推荐(0)