原创 C++ 關聯容器map的用法
這篇博客部分內容轉發自http://www.cnblogs.com/anywei/archive/2011/10/27/2226830.html C++中的關聯容器支持通過鍵來高效的查找和讀取元素。這裏我們介紹一下C++的關聯容器之一:
原创 [Leetcode]Find Minimum in Rotated Sorted Array I & II
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7
原创 Binary Tree Zigzag Level Order Traversal
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right
原创 [Leetcode]Flatten Binary Tree to Linked List (三種方法)
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5
原创 [Leetcode]Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid
原创 [Leetcode]Jump Game && Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element i
原创 [Leetcode]Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m
原创 [Leetcode]Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Give
原创 [Leetcode]Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 第一思路就是先把鏈
原创 [Leetcode]Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled,
原创 [Leetcode]Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equa
原创 [Leetcode]Path Sum && Path Sum II
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
原创 [Leetcode]Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's run
原创 [Leetcode]3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Ret
原创 [Leetcode]Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n =