原创 【筆記】mac配置文件

轉自http://blog.sina.com.cn/s/blog_62f189570102vd8a.html 1。修改profile文件:(所有用戶) #vi /etc/profile 加入:export PATH=$PATH:/u

原创 【leetcode】Array——Largest Rectangle in Histogram(84)

題目: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the a

原创 【leetcode】Array——Best Time to Buy and Sell Stock I/II/III

Best Time to Buy and Sell Stock 題目: Say you have an array for which the ith element is the price of a given stock on d

原创 【數據結構與算法設計】希爾排序

希爾排序( 最壞O(N^2)  ) 重要概念:增量序列 增量 增量hk習慣於取len/2,然後遞減hk=hk/2,直到等於1。 對於hk排序:下標爲hk,hk+1,...,len-1 元素i,i放到i,i-hk, i-2hk...正確的位

原创 【leetcode】Array——3Sum Closest(16)

題目: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. R

原创 【leetcode】Array——First Missing Positive(41)

題目: Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, a

原创 【leetcode】Array——Find Peak Element(162)

題目: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], fi

原创 【leetcode】Array——Find the Duplicate Number(287)

題目: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at le

原创 【leetcode】Array——Find Minimum in Rotated Sorted Array II(154)

題目:前一道題鏈接:http://blog.csdn.net/u013127687/article/details/50935939 Follow up for "Find Minimum in Rotated Sorted Array

原创 【leetcode】Array——Find Minimum in Rotated Sorted Array(153)

題目: 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

原创 【leetcode】Array——4Sum(18)

題目:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find al

原创 【leetcode】Array——Container With Most Water(11)

題目:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical l

原创 【leetcode】Array——Construct Binary Tree from Preorder and Inorder Traversal(105)

題目: Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates

原创 【leetcode】Array——Combination Sum I/II/III

Combination Sum 題目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wh

原创 【leetcode】Array——Jump Game2(45)

題目: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each eleme