原创 [Lintcode] 67. Binary Tree Inorder Traversal

給出一棵二叉樹,返回其中序遍歷。 public class Solution { /** * @param root: The root of binary tree. * @return: Inorder i

原创 Python分佈式爬蟲打造搜索引擎完整版-基於Scrapy、Redis、elasticsearch和django打造一個完整的搜索引擎網站

原文地址:http://blog.csdn.net/qq_23079443/article/details/73920584 Python分佈式爬蟲打造搜索引擎 基於Scrapy、Redis、elasticsearch和djan

原创 [Leetcode] 總結--Best Time to Buy and Sell Stock

原文鏈接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/discuss/ Most consistent way

原创 回溯法(Backtracking)總結(子集,全排列,組合和,迴文分割)

原文鏈接:https://discuss.leetcode.com/topic/46159/a-general-approach-to-backtracking-questions-in-java-subsets-permutation

原创 Rotate Matrix

public class RotateMatrix { public static int[][] rotate(int[][] matrix, int flag){ int m = matrix.length, n = mat

原创 Length of Valid Parentheses

public class ValidParentheses { public static int isValid(String s) { Stack<Character> stack = new Stack<>(); for

原创 Minimum Path Sum of a Binary Tree

class TreeNode{ int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } public class BSTMinimumPa

原创 [Lintcode] 632. Binary Tree Maximum Node

在二叉樹中尋找值最大的節點並返回。 public class Solution { /** * @param root the root of binary tree * @return the max no

原创 [Lintcode] 616. Order Dependency

你需要去上n門課才能獲得offer,這些課被標號爲0到n - 1。 有一些課程需要“前置課程”,比如如果你要上課程0,你需要先學課程1,我們用一個匹配來表示他們:[0, 1]。  給你課程的總數量和一些前置課程的需求,返回你爲了學完所

原创 Reverse Second Half of a Linked List

class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } public class ReverseSecondHalfofLinkedLis

原创 [Lintcode] 68. Binary Tree Postorder Traversal

給出一棵二叉樹,返回其節點值的後序遍歷。 public class Solution { /** * @param root: The root of binary tree. * @return: Posto

原创 [Lintcode] 105. Copy List with Random Pointer

給出一個鏈表,每個節點包含一個額外增加的隨機指針可以指向鏈表中的任何節點或空的節點。 返回一個深拷貝的鏈表。 public class Solution { public RandomListNode copyRando

原创 [Lintcode] 629. Minimum Spanning Tree

給出一些Connections,即Connections類,找到一些能夠將所有城市都連接起來並且花費最小的邊。 如果說可以將所有城市都連接起來,則返回這個連接方法;不然的話返回一個空列表。 例 給出 connections = ["Ac

原创 Java中遍歷Map的四種方法總結

原文地址:http://blog.csdn.net/disiwei1012/article/details/52937629 public static void main(String[] args) { Map<String

原创 [Lintcode] 66. Binary Tree Preorder Traversal

給出一棵二叉樹,返回其節點值的前序遍歷。 public class Solution { /** * @param root: The root of binary tree. * @return: Preor