摘要: 题目描述: Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 解题思路: 使用O(n)的时间复杂度及O(1)的时间复杂 阅读全文
posted @ 2016-02-06 19:43 scottwang 阅读(521) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1- 阅读全文
posted @ 2016-02-06 16:01 scottwang 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 -- 阅读全文
posted @ 2016-02-06 15:34 scottwang 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a 阅读全文
posted @ 2016-02-06 14:31 scottwang 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 题目描述: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Eac 阅读全文
posted @ 2016-02-06 13:47 scottwang 阅读(428) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occ 阅读全文
posted @ 2016-02-06 10:28 scottwang 阅读(431) 评论(0) 推荐(0) 编辑