包含min函数的栈
来源:互联网 发布:mac 好用的卸载软件 编辑:程序博客网 时间:2024/06/07 07:01
#include <stack>using namespace std;class Solution {public: void push(int value) { s.push(value); } void pop() { if (!s.empty()) {s.pop();} } int top() { return s.top(); } int min() { stack<int> temp; int max = ~(1 << (sizeof(int) * 8 - 1)); while (!s.empty()) { temp.push(top()); if (top() < max) { max = top(); } pop(); } while (!temp.empty()) { s.push(temp.top()); temp.pop(); } return max; }private: stack<int> s;};
阅读全文
0 0
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min 函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 包含min函数的栈
- 顺时针打印矩阵
- 简单的js+css的输入框自动提示功能实现
- tcpdump
- celery trying again
- Python BeautifulSoup4 select方法执行css选择器
- 包含min函数的栈
- 用于mmgrid表格批量删除的函数
- linux_守护进程
- Spring MVC原理及用法
- iSCSI
- Happiness
- 整数与IP地址间的转换
- Spring注入中byType和byName的总结
- 图像匹配算法之ORB