摘要:
Question You need to find the largest value in each row of a binary tree. Example: Solution 层次遍历。 Code 阅读全文
摘要:
Question Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this singl 阅读全文
摘要:
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 阅读全文
摘要:
C++中的queue自身是不支持clear操作的,但是双端队列deque是支持clear操作的。 方法一 直接用空的队列对象赋值 方法二 遍历出队列 方法三 使用swap,这种是最高效的,定义clear,保持STL容器的标准。 阅读全文