摘要: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
阅读全文
摘要:Implement wildcard pattern matching with support for '?' and '*'. 所以考虑用回溯。 此博客讲解的很详细,http://blog.csdn.net/u012848330/article/details/52596618
阅读全文
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the lo
阅读全文
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers. Note:The input is assumed to be a 3
阅读全文
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2
阅读全文
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".
阅读全文
摘要:Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leadin
阅读全文
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha
阅读全文
摘要:Implement regular expression matching with support for '.' and '*'. 1.p为空,那s必然也为空 2.s为空,看p的第二字符是否为*,为*的话 则为isMatch(s,p.substring(2)); 3.都不为空,p的第二字符为*,
阅读全文
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
摘要:Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc
阅读全文
摘要:leetcode 279. Perfect Squares Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to
阅读全文
摘要:leetcode 264. Ugly Number II Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
阅读全文
摘要:leetcode 152. Maximum Product Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest product. Fo
阅读全文
摘要:leetcode 120. Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. Fo
阅读全文
摘要:leetcode 304. Range Sum Query 2D - Immutable Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left cor
阅读全文
摘要:leetcode 303. Range Sum Query - Immutable Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Exampl
阅读全文
摘要:leetcode 91. Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message conta
阅读全文
摘要:leetcode 213. House Robber II Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new
阅读全文
摘要:leetcode 198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the
阅读全文