原创 LeetCode 234. Palindrome Linked List
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?
原创 LeetCode 53. Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example,
原创 Leetcode 139, Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of on
原创 LeetCode105. Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do no
原创 LeetCode 226. Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3
原创 LeetCode 40. Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the ca
原创 LeetCode 93. Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For exampl
原创 LeetCode 57. Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assu
原创 LeetCode 129. Sum Root to Leaf Numbers
iven a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is t
原创 LeetCode 257. Binary Tree Paths
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2
原创 LeetCode 27. Remove Element
Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate ex
原创 LeetCOde 64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum
原创 LeetCode 203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5
原创 LeetCode 116. Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode
原创 LeetCode344. Reverse String
Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "ol