自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(156)
  • 收藏
  • 关注

原创 153_leetcode_Find Minimum in Rotated Sorted Array II

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.The array may contain duplicates.1

2014-10-25 10:54:46 357

原创 152_leetcode_Find Minimum in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in

2014-10-25 10:52:19 358

原创 151_leetcode_Maximum Product Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the larges

2014-10-25 10:45:35 363

原创 150_leetcode_Valid Number

Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo

2014-07-25 10:47:21 411

原创 149_leetcode_Text Justification

vector fullJustify(vector &words, int L) { vector result; if(words.size() == 0) { return result; } int wordLength = 0;

2014-07-25 09:25:44 341

原创 148_leetcode_Word Ladder II

vector > findLadders(string start, string end, unordered_set &dict) { vector > result; if(start.length() == 0 || end.length() == 0 || start.length() != end.length() || start == end

2014-07-24 13:30:35 430

原创 147_leetcode_Palindrome Partitioning II

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 of s.For example, given s = "aab",Retu

2014-07-24 09:33:01 439

原创 146_leetcode_Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each

2014-07-23 17:25:06 305

原创 145_leetcode_Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"1:注意特殊情况;2:在u ni

2014-07-23 16:09:36 301

原创 144_leetcode_Substring with Concatenation of All Words

You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an

2014-07-23 11:06:36 279

原创 143_leetcode_Minimum Window Substring

string minWindow(string S, string T) { if(S.length() == 0 || T.length() == 0 || S.length() < T.length()) { return ""; } string result = "";

2014-07-23 09:47:59 479

原创 142_leetcode_Integer to Roman

string intToRoman(int num) { if(num <= 0) { return ""; } string result = ""; int tmpArray[13] = {1000, 900, 500, 400, 100, 90,

2014-07-22 17:01:22 339

原创 141_leetcode_Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.1:罗马数字 int romanToInt(string s) { if(s.size() == 0) {

2014-07-22 16:39:59 295

原创 140_leetcode_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

2014-07-22 16:18:23 332

原创 139_leetcode_Anagrams

vector anagrams(vector &strs) { if(strs.size() == 0) { return strs; } vector result; unordered_map myMap; for(int i = 0; i < (i

2014-07-22 15:30:34 327

原创 138_leetcode_Word Ladder

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 can be changed at a timeEach intermediate word m

2014-07-22 14:23:34 347

原创 137_leetcode_Implement strStr()

Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.1:注意te shu q

2014-07-22 11:04:55 351

原创 136_leetcode_Jump Game II

int jump(int A[], int n) { if(A == NULL || n <= 1) { return 0; } int steps = 1; int curMaxIndex = A[0]; int index = 1;

2014-07-22 10:17:00 494

原创 135_leetcode_Sqrt(x)

Implement the int sqrt(int x)1:注意特殊情况;2:使用高斯公式 a =

2014-07-22 09:52:10 327

原创 134_leetcode_LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if

2014-07-22 09:43:17 361

原创 133_leetcode_Median of Two Sorted Array

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

2014-07-21 17:24:56 406

原创 132_leetcode_Sudoku Solver

1:采用递归;2:j

2014-07-21 16:52:39 333

原创 131_leetcode_Valid Sudoku

bool isValidSudoku(vector > &board) { if(board.size() != 9 || board[0].size() != 9) { return false; } int rows = (int)board.size(); int

2014-07-21 16:25:28 391

原创 130_N-Queens II

计算N皇后的个数1:注意特殊情况;2:采用递归和回朔的 int totalNQueens(int n) { if( n <= 0 ) { return 0; } vector pos(n, 0); int totalNumber = 0;

2014-07-21 15:55:22 317

原创 129_leetcode_N-Queens

vector > solveNQueens(int n) { vector > result; if( n <= 0 ) { return result; } vector tmpSolve; vector pos(n, 0);

2014-07-21 15:48:04 340

原创 128_leetcode_Sort Colors

void sortColors(int A[], int n) { if(A == NULL || n <= 1) { return; } int leftIndex = -1; int rightIndex = n; int i = 0;

2014-07-21 15:18:42 384

原创 127_leetcode_Distinct Subsequences

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 the original string by deleting some (can be non

2014-07-21 15:04:14 320

原创 126_leetcode_Word Search

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 "adjacent" cells are those horizontally or vertically

2014-07-21 14:44:00 379

原创 125_leetcode_Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.1:注意特殊情况, 点的个数为1,2, 0的shi hou

2014-07-21 14:17:46 223

原创 124_leetcode_Surrounded Regions

void solve(vector> &board) { if(board.size() == 0 || board.size() == 1 || board[0].size() == 1 || board.size() == 2 || board[0].size() == 2) return; int rows = (in

2014-07-21 13:58:14 333

原创 123_leetcode_Word Break II

vector wordBreak(string s, unordered_set &dict) { vector result; if(s.length() < 1 || dict.size() == 0) { return result; } unordered_se

2014-07-21 13:30:09 442

原创 122_leetcode_wordBreak

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2014-07-21 11:13:27 356

原创 121_leetcode_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 t

2014-06-30 08:18:40 281

原创 120_leetcode_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

2014-06-30 08:02:30 313

原创 119_leetcode_Permutations II

Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1].

2014-06-30 07:41:58 393

原创 118_leetcode_Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","b"],

2014-06-25 09:51:51 297

原创 117_leetcode_Candy

There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on

2014-06-25 09:37:08 328

原创 116_leetcode_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.1:特殊情况;2:设置数组,字符串xiang che str

2014-06-24 16:59:38 277

原创 115_leetcode_Permutation Sequence

The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""3

2014-06-24 16:00:15 294

原创 114_leetcode_Gas Station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to

2014-06-24 15:26:41 423

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除