码迷,mamicode.com
首页 >  
搜索关键字:算法面试    ( 461个结果
LeetCode: N-Queens II [051]
【题目】 Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 【题意】 解N皇后问题,N-Queens要求返回所有的解,而本题只需要返回可行解的数目 【思路】 DFS,参考N-Queens...
分类:其他好文   时间:2014-05-25 01:51:55    阅读次数:236
LeetCode: Spiral Matrix [058]
【题目】 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You should return [1,2,3,6,9,8,7,4,5]. 【题意】 螺旋输出MxN...
分类:其他好文   时间:2014-05-24 23:11:02    阅读次数:279
LeetCode: Maximum Subarray [052]
【题目】 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [?2,1,?3,4,?1,2,1,?5,4], the contiguous subarray [4,?1,2,1] has the largest sum = 6. 【题意】 给定一个数组,找出和最大的子数组,返回...
分类:其他好文   时间:2014-05-24 22:19:17    阅读次数:260
LeetCode: Jump Game [054]
【题目】 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. For example:...
分类:其他好文   时间:2014-05-24 20:44:39    阅读次数:221
LeetCode: N-Queens [050]
【题目】 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. Each solution contains a distinct board configuratio...
分类:其他好文   时间:2014-05-24 17:12:32    阅读次数:237
LeetCode: Merge Intervals [055]
【题目】 Given an array of non-negative integers, you are initially positioned at the first index of the array. Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. ...
分类:其他好文   时间:2014-05-24 14:18:27    阅读次数:193
LeetCode: Permutations [045]
【题目】 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,3,1], [3,1,2], and [3,2,1]. 【题意】 给定一个数组,生成所有的全排列 【思路】 递归,类DFS...
分类:其他好文   时间:2014-05-23 01:08:26    阅读次数:194
LeetCode: Wildcard Matching [043]
【题目】 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 the entire input string (not partial). The functi...
分类:其他好文   时间:2014-05-23 00:17:12    阅读次数:364
LeetCode: Permutations II [046]
【题目】 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-05-22 17:32:17    阅读次数:247
LeetCode: Multiply Strings [042]
【题目】 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. 考虑其中一个数是0的情况 2. 模拟乘法运算...
分类:其他好文   时间:2014-05-21 13:45:37    阅读次数:214
461条   上一页 1 ... 40 41 42 43 44 ... 47 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!