摘要: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c) must be in non-descending order. (ie,a≤b≤c)The solution set must not contain duplicate triplets. For example, given array S... 阅读全文
posted @ 2014-03-05 22:06 andyqee 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Note:Recursive solution is trivial, could you do it iteratively?/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left;... 阅读全文
posted @ 2014-03-05 21:18 andyqee 阅读(110) 评论(0) 推荐(0) 编辑