摘要: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest palindromic substring.Summary: line 18, reduce unneccessary search 1 bool isPalindrome(string &s, int start, int end){ 2 while(start = i; j ... 阅读全文
posted @ 2013-12-05 13:47 假日笛声 阅读(369) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its zigzag level order traversal as:[ [3], ... 阅读全文
posted @ 2013-12-05 12:51 假日笛声 阅读(191) 评论(0) 推荐(0) 编辑