原创 CloneGraph

Clone an undirected graph. Each node in the graph contains a label and a list of itsneighbors. OJ's undirected graph se

原创 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},

原创 Leetcode: Sum Root to Leaf Number

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is th

原创 Leetcode: Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by'X'. A region is captured by flipping all 'O

原创 Copy List with Random Pointer

/* * A linked list is given * such that each node contains an additional random pointer * which could point to

原创 Leetcode: Insertion Sort List

Sort a linked list using insertion sort. /** * Definition for singly-linked list. * public class ListNode { * in

原创 Leetcode: Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you sol

原创 Gas Station

出自 http://blog.csdn.net/lbyxiafei/article/details/12183461 There are N gas stations along a circular route, where t

原创 Leetcode: 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 withou

原创 Word Break II

Given a string s and a dictionary of words dict, add spaces ins to construct a sentence where each word is a valid dic

原创 Single Number II

Given an array of integers, every element appears three times except for o

原创 Java 不同版本更新總結

面試時候雖沒有被問到,但是感覺在相關問題上丟了面試分,在此總結一下。 參考 Reference http://pwosboy.iteye.com/blog/118756 http://hanhg.iteye.com/blog/29195

原创 Leetcode Single Number

Given an array of integers, every element appears twice except for one. Find that single one. Could you implement it wi

原创 Leetcode: Linked List Cycle

Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? /** *

原创 [Random Coding]Interval Related Questions

對於每一個end point都生成了新的interval,所以最後一步要把相鄰並且weight相同的interval合併。 本例中,res中依然存在可以合併的interval。 import java.util.ArrayList; i