码迷,mamicode.com
首页 >  
搜索关键字:permutations ii    ( 7008个结果
LeetCode--Combination Sum II
思路:类似于上一题,但是加了一个index数组记录结果里面已经存放的元素索引,用来判断当前的元素是否和上一个相同并且上一个是否使用过。主要为了解决重复解的问题。 1 class Solution { 2 public: 3 vector >ans; 4 vector > combin...
分类:其他好文   时间:2014-08-03 23:01:56    阅读次数:213
Permutations leetcode java
题目:Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,....
分类:编程语言   时间:2014-08-03 10:09:25    阅读次数:193
LeetCode "Remove Duplicates from Sorted List II"
Corner cases!class Solution {public: ListNode *deleteDuplicates(ListNode *head) { if (!head) return head; if (!head->next) return hea...
分类:其他好文   时间:2014-08-03 07:51:34    阅读次数:237
Pascal's Triangle II Leetcode java
题目: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 ....
分类:编程语言   时间:2014-08-03 05:24:06    阅读次数:304
Spiral Matrix II leetcode java
题目: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the foll....
分类:编程语言   时间:2014-08-03 05:21:18    阅读次数:272
HDU-2128-Tempter of the Bone II(BFS)
Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze was changed and the way he came in was lost.He realized that the bo...
分类:其他好文   时间:2014-08-02 23:31:54    阅读次数:274
Single Number II
Single Number II Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?...
分类:其他好文   时间:2014-08-02 12:53:53    阅读次数:289
Unique Paths II leetcode java
题目:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty spa....
分类:编程语言   时间:2014-08-02 12:19:13    阅读次数:241
LeetCode "Permutations"
Lexicographicallyalgorithms:1. Iterate array from back to front, and find the first decreasing point: 1,2,4,3 -- 42. Iterate array from back to front,...
分类:其他好文   时间:2014-08-02 05:11:02    阅读次数:199
Combination Sum II leetcode java
题目:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each ....
分类:编程语言   时间:2014-08-02 01:48:12    阅读次数:246
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!