摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line. 1 /** 2 * Definition for a point. 3 * struct Point... 阅读全文
posted @ 2014-04-24 11:16 beehard 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be c... 阅读全文
posted @ 2014-04-24 10:59 beehard 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the". 1 class Solution { 2 public: ... 阅读全文
posted @ 2014-04-24 10:57 beehard 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another e... 阅读全文
posted @ 2014-04-24 10:48 beehard 阅读(160) 评论(0) 推荐(0) 编辑
摘要: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep cop... 阅读全文
posted @ 2014-04-24 10:25 beehard 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: Only one letter ... 阅读全文
posted @ 2014-04-24 09:49 beehard 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended fo... 阅读全文
posted @ 2014-04-24 09:33 beehard 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning... 阅读全文
posted @ 2014-04-24 08:41 beehard 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", ... 阅读全文
posted @ 2014-04-24 08:29 beehard 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2014-04-24 08:17 beehard 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For exampl... 阅读全文
posted @ 2014-04-24 06:49 beehard 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded... 阅读全文
posted @ 2014-04-24 06:17 beehard 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including ... 阅读全文
posted @ 2014-04-24 04:32 beehard 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati... 阅读全文
posted @ 2014-04-24 04:14 beehard 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. Solution: 1. dp. (72 milli secs ... 阅读全文
posted @ 2014-04-24 03:50 beehard 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["... 阅读全文
posted @ 2014-04-24 03:29 beehard 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You sho... 阅读全文
posted @ 2014-04-24 03:02 beehard 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it. For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" Corner Cases: ... 阅读全文
posted @ 2014-04-24 02:45 beehard 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac... 阅读全文
posted @ 2014-04-24 02:38 beehard 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t... 阅读全文
posted @ 2014-04-24 02:24 beehard 阅读(136) 评论(0) 推荐(0) 编辑