摘要:
1. Description One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it 阅读全文
摘要:
1. Description Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. 阅读全文
摘要:
1. Description Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: 阅读全文
摘要:
1. Description You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the we 阅读全文
摘要:
1. Description Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, 阅读全文
摘要:
1. Description The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the 阅读全文
摘要:
1. Description Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary repre 阅读全文
摘要:
一、前言 最开始打算分析ReentrantLock,但是分析到最后,发现离不开LockSuport的支持,所以,索性就先开始分析LockSupport,因为它是锁中的基础,是一个提供锁机制的工具类,所以先对其进行分析。 二、LockSupport源码分析 2.1 类的属性 public class 阅读全文
摘要:
一、前言 整个集合框架的常用类我们已经分析完成了,但是还有两个工具类我们还没有进行分析。可以说,这两个工具类对于我们操作集合时相当有用,下面进行分析。 二、Collections源码分析 2.1 类的属性 public class Collections { // 二分查找阈值 private st 阅读全文
摘要:
一、前言 继上一篇写完字节编码内容后,现在分析在Java中各字符编码的问题,并且由这个问题,也引出了一个更有意思的问题,笔者也还没有找到这个问题的答案。也希望各位园友指点指点。 二、Java字符编码 直接上代码进行分析似乎更有感觉。 public class Test { public static 阅读全文