摘要: 设计一个支持 push,pop,top 操作,并能在常数时间内检索到最小元素的栈。 push(x) -- 将元素 x 推入栈中。 pop() -- 删除栈顶的元素。 top() -- 获取栈顶元素。 getMin() -- 检索栈中的最小元素。 示例: 阅读全文
posted @ 2018-12-01 18:51 xinfenglee 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 给定一个链表,判断链表中是否有环。 进阶:你能否不使用额外空间解决此题? 阅读全文
posted @ 2018-12-01 11:20 xinfenglee 阅读(94) 评论(0) 推荐(0) 编辑
摘要: // Forward declaration of isBadVersion API. bool isBadVersion(int version); int firstBadVersion(int n) { int high = n; int low = 1; int mid ; int midVer; while(low <= high) {... 阅读全文
posted @ 2018-12-01 11:08 xinfenglee 阅读(216) 评论(0) 推荐(0) 编辑
摘要: /** * Return an array of arrays. * The sizes of the arrays are returned as *columnSizes array. * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free(). */ ... 阅读全文
posted @ 2018-12-01 00:58 xinfenglee 阅读(139) 评论(0) 推荐(0) 编辑