原创 leetcode1:Reverse Words in a String

問題如下 Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is

原创 leetcode15.candy

問題描述如下: There are N children standing in a line. Each child is assigned a

原创 leetcode6.LRU Cache

原文地址:http://blog.csdn.net/whuwangyi/article/details/15495845 問題就不描述了 實現代碼: class Node { Node prev; Node next; Si

原创 leetcode14.gasStation

問題描述如下: There are N gas stations along a circular route, where the amount of gas at stationi is gas[i]. You have a car

原创 leetcode8.binaryTree後續遍歷

問題不描述了,後續遍歷二叉樹,遞歸方法同leetcode7.(改下順序) 非遞歸方法 package leetcode6and7.BinaryTree; import java.util.ArrayList; import java.

原创 leetcode5:Insertion Sort Link

問題如下: Sort a linked list using insertion sort. 在eclipse上: 定義節點類: package leetcode5.InsertSortLink; public class ListNo

原创 leetcode12.wordBreak

代碼如下: package leetcode10.WordBreak; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; /*

原创 leetcode13.singleNumber

問題描述: Given an array of integers, every element appears three times except

原创 leetcode 難度及頻率 所用數據結構

LeetCode Question Difficulty Distribution : Sheet1 原文地址:LeetCode Question Difficulty Distribution : Sheet1  

原创 leetcode11.Linked List Cycle II

問題比之前的那個問題麻煩了點 iven a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up

原创 捕魚問題的java實現

今天看到了一個捕魚問題,覺得很不錯,自己也跟着琢磨了半天,寫了java的實現程序,現把問題敘述如下: 題目:20個桶,每個桶中有10條魚,用網從每個桶中抓魚,每次可以抓住的條數隨機,每個桶只能抓一次,問一共抓到180條的排列有多少種 (也

原创 shell學習資料整理

閒來無事,繼續學習shell,在CU上查看一些資料,覺得甚是不錯,記錄整理下來想必是極好的: 個人感覺應該側重:正則表達式,sed,awk這幾點(如不對歡迎指正,畢竟剛入門階段) shell基礎篇:ChinaUnix上Shell板塊,sh

原创 Leetcode9.reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without

原创 自己看鳥哥的書總結的常用linux指令

之前轉載了一個linux指令合集,那時還沒怎麼看鳥哥的書,回頭看來覺得那麼多指令太冗長了,總結了自己在ubuntu下的常用的一些指令 1.sudo su 並輸入自己的密碼能獲取root權限 2.alias 查看命令別名 3.man 命令,

原创 leetcode7.binary tree前序遍歷

題目:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/ Given a binary tree, return the preorder traversal o