摘要: Question You need to find the largest value in each row of a binary tree. Example: Solution 层次遍历。 Code 阅读全文
posted @ 2017-09-15 13:49 清水汪汪 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Question Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this singl 阅读全文
posted @ 2017-09-15 11:53 清水汪汪 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Question Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that a 阅读全文
posted @ 2017-09-15 10:14 清水汪汪 阅读(140) 评论(0) 推荐(0) 编辑
摘要: C++中的queue自身是不支持clear操作的,但是双端队列deque是支持clear操作的。 方法一 直接用空的队列对象赋值 方法二 遍历出队列 方法三 使用swap,这种是最高效的,定义clear,保持STL容器的标准。 阅读全文
posted @ 2017-09-15 09:40 清水汪汪 阅读(71188) 评论(0) 推荐(9) 编辑