码迷,mamicode.com
首页 >  
搜索关键字:permutations ii    ( 7008个结果
Permutations II leetcode java
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique....
分类:编程语言   时间:2014-08-08 01:54:55    阅读次数:292
HDU 1165 Eddy's research II (推公式)
Eddy's research IITime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3122Accepted Submission(s): 1137...
分类:其他好文   时间:2014-08-07 00:44:57    阅读次数:260
[LeetCode] Unique Binary Search Trees II (难以忍受的递归)
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example, Given n = 3, your program should return all...
分类:其他好文   时间:2014-08-07 00:16:36    阅读次数:276
Spiral Matrix II
问题:蛇形矩阵分析:设置变量dir,0123分别代表方向右下左上class Solution {public: int num[300][300]; void dfs(int x,int y,int k,int n,int dir) { num[x][y]=k; ...
分类:其他好文   时间:2014-08-06 22:25:42    阅读次数:169
Permutations
问题:全排列class Solution {public: void dfs(vector &num,vector &vec2,vector >&vec1,int step,int vis[]) { if(step==num.size()) { ...
分类:其他好文   时间:2014-08-06 22:25:02    阅读次数:193
Binary Tree Level Order Traversal II
问题:输出二叉树的每一行的结点,从叶子到根/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(i...
分类:其他好文   时间:2014-08-06 22:04:02    阅读次数:185
Pascal's Triangle II
问题:输出杨辉三角的第n行class Solution {public: vector getRow(int rowIndex) { vector vec; int a[100][100]; a[0][0]=1; int j,i; ...
分类:其他好文   时间:2014-08-06 22:03:42    阅读次数:214
Remove Duplicates from Sorted Array II
问题:消除数组中重复次数超过三次的多余的数分析:若ai-1==ai-2若ai也相等,则清楚aiclass Solution {public: int removeDuplicates(int A[], int n) { int i,j; for(i=2;i<n;i+...
分类:其他好文   时间:2014-08-06 21:41:52    阅读次数:199
HDU 4911 水
对于n个数,可以做k次移动,每次移动可以互换相邻位置的两个数,问最少 number of pair (i,j) where 1≤ii>aj. 如果不移动的话,ans=’n个数的逆序对数‘,移动k次会减少k个 归并排序求逆序对数: #include "stdio.h" #include "string.h" #include "math.h" int b[100010],a[1...
分类:其他好文   时间:2014-08-06 14:53:51    阅读次数:211
Word Ladder II leetcode java
题目: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 b....
分类:编程语言   时间:2014-08-06 01:52:30    阅读次数:251
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!