2015年4月21日

LeetCode-152 Maximum Product Subarray

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文

posted @ 2015-04-21 21:55 linxiong1991 阅读(98) 评论(0) 推荐(0) 编辑

2015年4月20日

LeetCode-187 Repeated DNA Sequences

摘要: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to ... 阅读全文

posted @ 2015-04-20 23:10 linxiong1991 阅读(651) 评论(0) 推荐(0) 编辑

LeetCode-201 Bitwise AND of Numbers Range

摘要: Given a range [m, n] where 0 >= 1; n >>= 1; a <<= 1; } return mc & a; } 阅读全文

posted @ 2015-04-20 18:14 linxiong1991 阅读(89) 评论(0) 推荐(0) 编辑

2015年4月8日

Java 引用类型

摘要: 问题:在JDK1.2以前,对象只有“被引用”和“不被引用”两种状态,对于一些“现在没用,但不确定以后是否有用”的对象,在这种场景下只能被定义为“不被引用”,因而会被垃圾回收。一旦将来使用到该对象,就会发现这个对象找不到了。我们希望描述这样的一类对象:如果内存空间充足,则保持在内存中;如果垃圾回收后的... 阅读全文

posted @ 2015-04-08 10:34 linxiong1991 阅读(264) 评论(0) 推荐(0) 编辑

2015年4月7日

Java 类加载器

摘要: 作用:通过类的的权限定名来获取描述此类的二进制字节流JVM中的每个类都由它的类加载器和类本身唯一确定,不同的类加载器有独立的命名空间,同一个类在不同的类加载器中是不同的。分类:主要可以分为三类:1. 启动类加载器(Bootstrap ClassLoader) 由C++实现,是JVM的一部分;用于加... 阅读全文

posted @ 2015-04-07 21:39 linxiong1991 阅读(129) 评论(0) 推荐(0) 编辑

2015年4月5日

编程之美3.8 求二叉树中节点的最大距离

摘要: 描述:如果把二叉树看成一个图,父子节点之间的连线看成双向的,定义“距离”为两个节点之间边的个数。求二叉树中相距最远的两个节点的距离。思路:相距最远的两个节点一定是叶子节点,且这两个叶子节点的路径有两种情况:1. 该路径经过root节点,则两个叶子节点分属root.left和root.right为根的... 阅读全文

posted @ 2015-04-05 18:00 linxiong1991 阅读(337) 评论(0) 推荐(0) 编辑

2015年3月28日

LeetCode-101 Symmetric Tree

摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文

posted @ 2015-03-28 22:53 linxiong1991 阅读(133) 评论(0) 推荐(0) 编辑

2015年3月23日

LeetCode-130 Surrounded Regions

摘要: Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region... 阅读全文

posted @ 2015-03-23 18:03 linxiong1991 阅读(78) 评论(0) 推荐(0) 编辑

2015年3月19日

LeetCode-139 Word Break

摘要: Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文

posted @ 2015-03-19 18:17 linxiong1991 阅读(91) 评论(0) 推荐(0) 编辑

LeetCode-124 Binary Tree Maximum Path Sum

摘要: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ... 阅读全文

posted @ 2015-03-19 12:06 linxiong1991 阅读(150) 评论(0) 推荐(0) 编辑

导航