Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note: Could you optimize your algorithm to use only O(k) extra space?
题目大意
给定一个索引k,...
分类:
其他好文 时间:
2015-01-27 18:21:38
阅读次数:
172
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from B. The...
分类:
其他好文 时间:
2015-01-27 14:57:01
阅读次数:
149
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Anagrams:即字母个数和字母都相同,但是字母顺序不相...
分类:
其他好文 时间:
2015-01-27 00:08:17
阅读次数:
250
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You may not eng...
分类:
编程语言 时间:
2015-01-26 13:45:27
阅读次数:
200
题目:
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use co...
分类:
编程语言 时间:
2015-01-26 13:41:55
阅读次数:
253
Given an array S of n integers, are there elements a, b, c in S such that a + b + c =
0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a triplet (a,b,c...
分类:
其他好文 时间:
2015-01-26 13:41:30
阅读次数:
95
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use con...
分类:
编程语言 时间:
2015-01-26 12:02:14
阅读次数:
197
#include
#include
#include
#include
#include
using namespace std;
const int maxn=30;
int head[maxn],ip,indegree[maxn];
int n,m,seq[maxn];
struct note
{
int v,next;
} edge[maxn*maxn];
void ...
分类:
编程语言 时间:
2015-01-25 21:05:21
阅读次数:
274
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.public class Solution { pu...
分类:
其他好文 时间:
2015-01-25 20:55:19
阅读次数:
119
JavaScriptNoteBook【浏览器对空白文本节点的兼容问题】注意:IE浏览器中会忽略元素节点之间的空白节点,而且其他浏览器不会忽略【解决办法方法】(使用三元运算符):varresult=baby.nextSibling.nodeType==1?baby.nextSibling:baby.nextSibling.nextSibling;【注释】如果baby...
分类:
编程语言 时间:
2015-01-25 19:43:07
阅读次数:
179