12 2013 档案

Longest Substring Without Repeating Characters [LeetCode]
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.S 阅读全文

posted @ 2013-12-06 14:48 假日笛声 阅读(415) 评论(0) 推荐(0)

Longest Palindromic Substring [LeetCode]
摘要: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 假日笛声 阅读(378) 评论(0) 推荐(0)

Binary Tree Zigzag Level Order Traversal [LeetCode]
摘要: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 假日笛声 阅读(206) 评论(0) 推荐(0)