LeetCode Contains Duplicate II Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums = numsand the difference between i and j is at most k. 本题是LeetCode Contains... Read More

# Monthly Archives: October 2016

# LeetCode Contains Duplicate

LeetCode Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is... Read More

# LeetCode Sum Root to Leaf Numbers

LeetCode Sum Root to Leaf Numbers Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the total sum of all... Read More

# LeetCode Binary Tree Level Order Traversal

LeetCode Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree , 3 / \ 9 20 / \ 15 7 return its... Read More

# LeetCode Remove Linked List Elements

LeetCode Remove Linked List Elements Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 -->... Read More

# LeetCode Path Sum II

LeetCode Path Sum II Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / /... Read More

# LeetCode Path Sum

LeetCode Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree and sum = 22, 5 ... Read More

# LeetCode Binary Tree Postorder Traversal

LeetCode Binary Tree Postorder Traversal Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return . Note: Recursive solution is trivial, could you do... Read More

# LeetCode Binary Tree Preorder Traversal

LeetCode Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return . Note: Recursive solution is trivial, could you do it... Read More

# LeetCode Binary Tree Inorder Traversal

LeetCode Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree , 1 \ 2 / 3 return . Note: Recursive solution is trivial, could you do it... Read More