Q: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 sho...
分类:
其他好文 时间:
2014-10-20 20:47:32
阅读次数:
231
解题报告题意:原本区间1到n都是1,区间成段改变成一个值,求最后区间1到n的和。思路:线段树成段更新,区间去和。#include #include #include using namespace std;int sum[500000],lz[500000];void push_up(int roo...
分类:
其他好文 时间:
2014-10-20 20:46:57
阅读次数:
217
杨辉三角,分别求前n行和第n行。
【求杨辉三角前n行】
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,...
分类:
其他好文 时间:
2014-10-20 19:32:35
阅读次数:
190
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,...
分类:
其他好文 时间:
2014-10-20 18:53:45
阅读次数:
236
Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes co...
分类:
其他好文 时间:
2014-10-20 18:50:54
阅读次数:
111
Word Break IIGiven a string s and a dictionary of words dict, add spaces in s toconstruct a sentence where each word is a valid dictionaryword.Return ...
分类:
其他好文 时间:
2014-10-20 17:10:28
阅读次数:
466
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2014-10-20 14:46:35
阅读次数:
230
【题目】
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...
分类:
其他好文 时间:
2014-10-20 11:51:28
阅读次数:
239
【题目】
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down o...
分类:
其他好文 时间:
2014-10-19 21:25:37
阅读次数:
247
题目:给两个字符串S和T,判断T在S中出现的次数。
A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a subsequence...
分类:
其他好文 时间:
2014-10-19 17:09:51
阅读次数:
190