摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.255.11.135", "255.255.111.35"]. (Order does not matter)ref:http://www.cnblogs.com/feiling/p/3301869.htmlpublic static Arr 阅读全文
posted @ 2014-02-11 16:21 Razer.Lu 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the original relative order of the nodes in each of the two partitions.For example,Given1->4->3->2->5->2andx= 3,return1->2->2->4->3- 阅读全文
posted @ 2014-02-11 15:01 Razer.Lu 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You should return[1,2,3,6,9,8,7,4,5].相当于一圈一圈的剥掉矩阵,剥掉一圈,row-2, col-2 1 public class Solution { 2 public ArrayList spiralO... 阅读全文
posted @ 2014-02-11 14:05 Razer.Lu 阅读(158) 评论(0) 推荐(0) 编辑