2015年7月2日

摘要: 题目:Implement Stack using QueuesImplement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the el... 阅读全文
posted @ 2015-07-02 12:20 安德 阅读(125) 评论(0) 推荐(0) 编辑

2015年7月1日

摘要: 题目:Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1解答:# Definition fo... 阅读全文
posted @ 2015-07-01 09:41 安德 阅读(144) 评论(0) 推荐(0) 编辑

2015年6月30日

摘要: 题目:Basic Calculator IIImplement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,... 阅读全文
posted @ 2015-06-30 20:16 安德 阅读(138) 评论(0) 推荐(0) 编辑
 
摘要: 题目:Summary RangesGiven a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->... 阅读全文
posted @ 2015-06-30 17:16 安德 阅读(167) 评论(0) 推荐(0) 编辑

2015年6月29日

摘要: 题目:Majority Element IIGiven an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time an... 阅读全文
posted @ 2015-06-29 18:32 安德 阅读(108) 评论(0) 推荐(0) 编辑
 
摘要: 题目:Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"我的解答:/** * @param {st... 阅读全文
posted @ 2015-06-29 15:17 安德 阅读(156) 评论(0) 推荐(0) 编辑

2015年5月15日

摘要: 面试中,因为我说自己熟悉C++,就问我一个问题,Vector里, 想把元素为2的节点删除掉。该怎么做。我已经很久没有用Vector了,但是只有硬着头皮想一下,第一个想起的是remove能删除节点,但是不是真正的删除,还需要erase.但是因为Vector是顺序存储的数据结构,我觉得,一个节点删除掉后... 阅读全文
posted @ 2015-05-15 12:45 安德 阅读(147) 评论(0) 推荐(0) 编辑