Hiroki

大部分笔记已经转移到 https://github.com/hschen0712/machine_learning_notes ,QQ:357033150, 欢迎交流

2015年10月23日

Leetcode 225 两个队列实现栈

摘要: Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top()... 阅读全文

posted @ 2015-10-23 18:42 Hiroki 阅读(269) 评论(0) 推荐(0)

Leetcode225 用栈实现队列

摘要: 大众思路:用两个栈实现,记为s1,s21.元素入栈时,加入s12.元素出栈时,对s2进行判断,如果s2为空,则将全部s1元素弹出并压入到s2,然后从s2栈顶弹出一个元素;如果s2不为空,则直接从s2的栈顶弹出一个元素冷门思路:这种思路效率比较低1.元素入栈时,加入s12.元素出栈时,对s2进行判断,... 阅读全文

posted @ 2015-10-23 17:04 Hiroki 阅读(266) 评论(0) 推荐(0)

导航