上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 46 下一页

2014年12月11日

Path Sum II

摘要: Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tr... 阅读全文

posted @ 2014-12-11 19:12 luckygxf 阅读(194) 评论(0) 推荐(0) 编辑

java synchronized(一)

摘要: java synchronized主要用于控制线程同步,中间有很多小的细节,知识,这里我简单的整理一下,做个记录。主要用于方法和代码块的控制先说说方法控制模拟银行存款和取款,创建一个Account类,两个属性,一个name和accout。先存1w进去,在用一100个线程取钱1k和存1k。等待所有线程... 阅读全文

posted @ 2014-12-11 11:14 luckygxf 阅读(193) 评论(0) 推荐(0) 编辑

2014年12月10日

Sum Root to Leaf Numbers

摘要: Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l... 阅读全文

posted @ 2014-12-10 21:47 luckygxf 阅读(169) 评论(0) 推荐(0) 编辑

2014年12月9日

Letter Combinations of a Phone Number

摘要: Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit ... 阅读全文

posted @ 2014-12-09 20:54 luckygxf 阅读(174) 评论(0) 推荐(0) 编辑

2014年12月8日

java并发编程(一)

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

posted @ 2014-12-08 22:04 luckygxf 阅读(174) 评论(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 阅读(172) 评论(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 阅读(176) 评论(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 阅读(151) 评论(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 阅读(137) 评论(0) 推荐(0) 编辑

2014年12月7日

Best Time to Buy and Sell Stock II

摘要: Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the ... 阅读全文

posted @ 2014-12-07 09:55 luckygxf 阅读(132) 评论(0) 推荐(0) 编辑

上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 46 下一页

导航