动归
chuandalishuo
这个作者很懒,什么都没留下…
展开
-
5. Longest Palindromic Substring
1. Java 1.1. From center to two sides, try every letter and the every two letters O(n^2) public class Solution { public static String findPalindrome(String s, int begin, int end){ while(原创 2016-02-24 14:32:40 · 127 阅读 · 0 评论 -
174. Dungeon Game
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p原创 2016-10-09 12:38:05 · 152 阅读 · 0 评论 -
374,375. Guess Number Higher or Lower I,II
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I'll tell you whether the number I pi原创 2016-11-03 14:22:42 · 250 阅读 · 0 评论 -
121.122.123.188. Best Time to Buy and Sell Stock I II III IV
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2016-10-18 08:23:58 · 266 阅读 · 0 评论 -
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 only constraint stopping you from robbing each of them is that adjacent house原创 2016-10-20 04:59:55 · 156 阅读 · 0 评论 -
32. Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()",原创 2016-11-03 01:07:03 · 159 阅读 · 0 评论 -
221. Maximal Square
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0原创 2016-12-10 16:39:14 · 181 阅读 · 0 评论 -
91. Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total nu原创 2016-12-05 03:04:28 · 194 阅读 · 0 评论 -
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input st原创 2016-12-05 07:58:50 · 273 阅读 · 0 评论