摘要:
题目:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeati... 阅读全文
posted @ 2015-04-20 09:56
GoNuts
阅读(236)
评论(0)
推荐(0)
摘要:
题目:Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjace... 阅读全文
posted @ 2015-04-19 05:37
GoNuts
阅读(159)
评论(0)
推荐(0)
摘要:
题目:Given a range [m, n] where 0 >>= 1; 8 n >>>= 1; 9 count++;10 }11 return m <<= count;12 } 阅读全文
posted @ 2015-04-18 08:03
GoNuts
阅读(379)
评论(0)
推荐(0)
摘要:
题目:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL... 阅读全文
posted @ 2015-04-12 01:29
GoNuts
阅读(97)
评论(0)
推荐(0)
摘要:
题目:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costsco... 阅读全文
posted @ 2015-04-12 01:24
GoNuts
阅读(188)
评论(0)
推荐(0)
摘要:
题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele... 阅读全文
posted @ 2015-04-10 12:03
GoNuts
阅读(141)
评论(0)
推荐(0)
摘要:
这两个题,都是用bit operation解决的,但是第二个稍微tricky一点。先说第一个,我们利用XOR, 如果一个数字出现两次,那么在每一位上,两两抵消。唯独那个只出现一次的,没有另一半和它抵消了。。所以就剩下了。 1 public int singleNumber(int[] A) ... 阅读全文
posted @ 2015-04-10 06:59
GoNuts
阅读(135)
评论(0)
推荐(0)
摘要:
题目:Given a string, find the length of the longest substring without repeating characters.For example, the longest substring without repeating letters ... 阅读全文
posted @ 2015-04-10 05:16
GoNuts
阅读(131)
评论(0)
推荐(0)
摘要:
题目:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exa... 阅读全文
posted @ 2015-04-10 04:01
GoNuts
阅读(121)
评论(0)
推荐(0)
摘要:
题目:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exa... 阅读全文
posted @ 2015-04-10 01:44
GoNuts
阅读(121)
评论(0)
推荐(0)
浙公网安备 33010602011771号