摘要: Multiply StringsMar 12 '12Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.uncompletedpublic class Solution { public String multiply(String num1, String num2) { // Start typing your Java sol 阅读全文
posted @ 2013-02-18 17:47 西施豆腐渣 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Partition ListApr 30 '12Given 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,retu 阅读全文
posted @ 2013-02-18 12:27 西施豆腐渣 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Spiral Matrix IIMar 28 '12Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ]public class Solution { public int[][] generateMatrix(int n) { // ... 阅读全文
posted @ 2013-02-18 08:02 西施豆腐渣 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Spiral MatrixMar 25 '12Given 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].public class Solution { public ArrayList<Integer> sp 阅读全文
posted @ 2013-02-18 07:40 西施豆腐渣 阅读(119) 评论(0) 推荐(0) 编辑