2014年12月8日

java并发编程(一)

摘要: 多个线程访问同一个变量时,可能会出现问题。这里我用两个线程同时访问一个int count变量,让他们同时+1。同时让线程睡眠1秒,每个线程执行10次,最后应该输出20才对,因为count++并不是原子操作,这里需要做并发处理,如用syn...什么关键词,当然还有别的方法。后面在说这里为了是两个线程访... 阅读全文

posted @ 2014-12-08 22:04 luckygxf 阅读(176) 评论(0) 推荐(0) 编辑

Spiral Matrix II

摘要: Spiral Matrix IIGiven an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the... 阅读全文

posted @ 2014-12-08 21:23 luckygxf 阅读(173) 评论(0) 推荐(0) 编辑

Spiral Matrix

摘要: Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[... 阅读全文

posted @ 2014-12-08 20:20 luckygxf 阅读(177) 评论(0) 推荐(0) 编辑

Search in Rotated Sorted Array II

摘要: Search in Rotated Sorted Array IIFollow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity... 阅读全文

posted @ 2014-12-08 16:31 luckygxf 阅读(152) 评论(0) 推荐(0) 编辑

Search in Rotated Sorted Array

摘要: Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).... 阅读全文

posted @ 2014-12-08 16:19 luckygxf 阅读(140) 评论(0) 推荐(0) 编辑

导航