摘要: http://oj.leetcode.com/problems/wildcard-matching/Implement 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 阅读全文
posted @ 2013-11-11 17:52 移山测试工作室黑灯老师 阅读(800) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/multiply-strings/Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.思路:这是一道经常出现的面试题。竖式乘法怎么做的照搬就可以,注意看代码,用一个string搞定。class Solution {public: string multiply(strin... 阅读全文
posted @ 2013-11-07 15:27 移山测试工作室黑灯老师 阅读(2028) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/trapping-rain-water/Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.The above elevation map is represented by a 阅读全文
posted @ 2013-11-07 15:09 移山测试工作室黑灯老师 阅读(1031) 评论(0) 推荐(1) 编辑
摘要: 更多内容敬请期待。解法是否最优不能保证,但OJ肯定是能过的。1: Two Sum2:Median of Two Sorted Arrays3: Longest Substring Without Repeating Characters4:Add Two Numbers5:Longest Palindromic Substring6:ZigZag Conversion7:Reverse Integer8:String to Integer (atoi)9:Palindrome Number10:Regular Expression Matching11:Container With Most 阅读全文
posted @ 2013-11-06 10:22 移山测试工作室黑灯老师 阅读(943) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/first-missing-positive/Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant space.思路:显然排序数数的方法是不能用了。解决的思路很简单,我们要找的是第一个没有出现的正数,那么如果我们 阅读全文
posted @ 2013-11-06 10:08 移山测试工作室黑灯老师 阅读(413) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/combination-sum-ii/Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.Note:All numbers (including target) will be positi 阅读全文
posted @ 2013-11-05 10:18 移山测试工作室黑灯老师 阅读(1314) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/combination-sum/Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of times.Note:All numbers (including target) will be po 阅读全文
posted @ 2013-11-04 18:11 移山测试工作室黑灯老师 阅读(785) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/count-and-say/The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as "one 2, then one 1" or 1211.Given an i 阅读全文
posted @ 2013-11-04 13:42 移山测试工作室黑灯老师 阅读(367) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/sudoku-solver/Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku puzzle......and its solution numbers marked in red.思路:和前面一题Vali 阅读全文
posted @ 2013-11-04 10:55 移山测试工作室黑灯老师 阅读(3692) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/linked-list-cycle-ii/Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?思路:如果前面Linked List Cycle的问题已经解决,再扩展一下就可以了。如果一步走两步走的方法在某个点交汇了,那么这个点肯定在环内。那么算出环的长度n,令某个节点从head出发先走n步, 阅读全文
posted @ 2013-11-01 13:33 移山测试工作室黑灯老师 阅读(461) 评论(0) 推荐(0) 编辑
count website visits
Buy Computers