上一页 1 2 3 4 5 6 7 8 ··· 14 下一页
摘要: Wildcard MatchingMar 16 '12Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cover the entire input string (not partial). The f 阅读全文
posted @ 2013-02-21 04:59 西施豆腐渣 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 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 西施豆腐渣 阅读(112) 评论(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 西施豆腐渣 阅读(119) 评论(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 西施豆腐渣 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Populating Next Right Pointers in Each Node IIOct 28 '12Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extra space.For example,Given the followin 阅读全文
posted @ 2013-02-17 17:16 西施豆腐渣 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Populating Next Right Pointers in Each NodeOct 28 '12Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should b... 阅读全文
posted @ 2013-02-17 17:00 西施豆腐渣 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Sort ColorsApr 9 '12Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.Note:You are 阅读全文
posted @ 2013-02-17 14:29 西施豆腐渣 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Reverse Linked List IIJun 27 '12Reverse 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.Note:Givenm,nsatisfy the following condition:/** * Definition for singly-linked list. 阅读全文
posted @ 2013-02-17 10:35 西施豆腐渣 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!If the integer's last digit is 0, what should the output be? ie, cas 阅读全文
posted @ 2013-02-16 14:44 西施豆腐渣 阅读(154) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 14 下一页