2017年5月7日

Leetcode 61 -- Rotate List

摘要: Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2-> 阅读全文

posted @ 2017-05-07 22:59 linxiong1991 阅读(110) 评论(0) 推荐(0) 编辑

2016年1月9日

将博客搬至CSDN

摘要: 把博文搬到CSDN 阅读全文

posted @ 2016-01-09 13:54 linxiong1991 阅读(71) 评论(0) 推荐(0) 编辑

2015年8月20日

微软校招面试-已知f(x),求g(x)

摘要: 描述:已知f(x)是一个可以生成1,2,3,4,5的随机数生成器。用f(x)生成一个新的随机数生成器g(x),g(x)的生成数的范围是1~13,且13个数出现的概率相同。思路:设q(x)是一个可以生成1~25的随机数生成器,先处理:f(x)->q(x)利用f(x)生成两个随机数,这两个随机数可以有2... 阅读全文

posted @ 2015-08-20 23:27 linxiong1991 阅读(244) 评论(0) 推荐(0) 编辑

2015年8月16日

微软实习面试-删除一个JAVA文件的全部注释

摘要: 描述:删除一个合法的JAVA文件的全部注释,注释以"//"或者"/* */"表示。注意: 单引号或者双引号内的文字可能包括"//"或者"/* */",但不是注释的部分。解法:读入文件后,一个字符一个字符的处理。 1 public void deleteAllComment(InputStream i... 阅读全文

posted @ 2015-08-16 18:20 linxiong1991 阅读(208) 评论(0) 推荐(0) 编辑

2015年8月1日

leetcode 223-Rectangle Area

摘要: Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ... 阅读全文

posted @ 2015-08-01 23:32 linxiong1991 阅读(127) 评论(0) 推荐(0) 编辑

2015年5月25日

JAVA 对象分配过程

摘要: 1. 在JAVA中,对象的分配一般使用new关键字。 当虚拟机遇到new指令时,会先检查该指令所包含的参数在常量池中能否找到一个符号引用,并检查该符号引用所代表的类是否被加载、解析和初始化。 如果没有,则会先执行类的加载过程。2. 类加载完成后,会为该对象分配内存空间。一个对象需要多大的内存空间在... 阅读全文

posted @ 2015-05-25 14:55 linxiong1991 阅读(3150) 评论(0) 推荐(0) 编辑

2015年5月20日

leetcode 212-Word Search II

摘要: Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjac... 阅读全文

posted @ 2015-05-20 21:03 linxiong1991 阅读(192) 评论(0) 推荐(0) 编辑

2015年5月19日

LeetCode-4 Median of Two Sorted Arrays

摘要: There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文

posted @ 2015-05-19 17:34 linxiong1991 阅读(341) 评论(0) 推荐(0) 编辑

2015年5月13日

LeetCode-Maximum Gap

摘要: Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ... 阅读全文

posted @ 2015-05-13 11:39 linxiong1991 阅读(255) 评论(0) 推荐(0) 编辑

2015年5月12日

LeetCode-Longest Consecutive Sequence

摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文

posted @ 2015-05-12 22:59 linxiong1991 阅读(101) 评论(0) 推荐(0) 编辑

导航