随笔 - 395  文章 - 3  评论 - 49  阅读 - 85万
04 2014 档案
面试题 Comparable、Comparator 比较
摘要:Comparable 用作默认的比较方式 Comparator 用作自定义的比较方式,当默认的比较方式不适用时或者没有提供默认的比较方式,使用Comparator就非常有用。 像Arrays和Collections中的排序方法,当不指定Comparator时使用的就是默认排序方式,也就是使用Comp... 阅读全文
posted @ 2014-04-22 15:03 wf110 阅读(188) 评论(0) 推荐(0) 编辑
Longest Palindromic Substring
摘要:http://www.felix021.com/blog/read.php?2040下面以字符串12212321为例,经过上一步,变成了 S[] = "$#1#2#2#1#2#3#2#1#";然后用一个数组 P[i] 来记录以字符S[i]为中心的最长回文子串向左/右扩张的长度(包括S[i]),比如S... 阅读全文
posted @ 2014-04-21 18:02 wf110 阅读(202) 评论(0) 推荐(0) 编辑
Permutation Sequence
摘要:Permutation SequenceTotal Accepted:6325Total Submissions:29550My SubmissionsThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and... 阅读全文
posted @ 2014-04-20 19:13 wf110 阅读(1527) 评论(0) 推荐(0) 编辑
正则表达式学习网站
摘要:http://blog.csdn.net/fightforyourdream/article/details/12900751 阅读全文
posted @ 2014-04-18 15:04 wf110 阅读(256) 评论(0) 推荐(0) 编辑
Longest Substring Without Repeating Characters
摘要:charTables数组记录字符对应的位置。public class Solution { public int lengthOfLongestSubstring(String s) { if(null==s||0==s.length()) return 0; ... 阅读全文
posted @ 2014-04-18 10:43 wf110 阅读(231) 评论(0) 推荐(0) 编辑
保留小数点后几位数字
摘要:四舍五入保留小数点 1 方法一: 2 double myNum2 = 111231.5585478; 3 java.math.BigDecimal b = new java.math.BigDecimal(myNum2); 4 double myNum3 = b.setScale(4, ja... 阅读全文
posted @ 2014-04-17 16:52 wf110 阅读(388) 评论(0) 推荐(0) 编辑
ReentrantLock和synchronized的区别随笔
摘要:http://wsmajunfeng.iteye.com/blog/1492316可重入锁ReentrantLock的含义是:当某个线程获取某个锁后,在未释放锁的情况下,第二次再访问该锁锁定的另一代码块时,可以重新进入该块。什么情况下可以使用ReentrantLock:1,先看看synchroniz... 阅读全文
posted @ 2014-04-15 20:11 wf110 阅读(222) 评论(0) 推荐(0) 编辑
范型 小编
摘要:1 class Info 2 { 3 private T var; 4 5 public T getVar() { 6 return var; 7 } 8 9 public void setVar(T var) {10 this.... 阅读全文
posted @ 2014-04-14 10:46 wf110 阅读(280) 评论(0) 推荐(0) 编辑
两个线程交替打印字符串
摘要:每个对象都有一内置锁wait方法 释放对象锁(不占对象锁)sleep方法不释放对象锁(占对象锁)优秀写法 (下面写法可能有问题,synchronized (LOCK) 提到 while前面就好了) 1 class Info { 2 String printStr = "i think thi... 阅读全文
posted @ 2014-04-11 11:02 wf110 阅读(7983) 评论(0) 推荐(0) 编辑
Gray Code
摘要:[leetcode]Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0. For example, given n = 2, return 阅读全文
posted @ 2014-04-10 10:36 wf110 阅读(311) 评论(0) 推荐(0) 编辑
Ajax
摘要:XMLHttpRequest 对象用于和服务器交换数据。向服务器发送请求如需将请求发送到服务器,我们使用 XMLHttpRequest 对象的 open() 和 send() 方法:xmlhttp.open("GET","test1.txt",true);xmlhttp.send();方法描述ope... 阅读全文
posted @ 2014-04-03 17:03 wf110 阅读(193) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示