码迷,mamicode.com
首页 >  
搜索关键字:算法面试    ( 461个结果
LeetCode: Remove Duplicates from Sorted Array [025]
【题目】 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example, Given input array A ...
分类:其他好文   时间:2014-05-18 18:25:19    阅读次数:272
LeetCode 016 3Sum Closest
【题目】 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {...
分类:其他好文   时间:2014-05-18 10:37:57    阅读次数:269
LeetCode: Valid Parentheses [020]
【题目】 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. 【题意】 判断给定的字符串是否是合法的...
分类:其他好文   时间:2014-05-18 10:08:11    阅读次数:327
LeetCode: Generate Parentheses [021]
【题目】 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())", "()()()" 【题意】 给定n对括号,输出所有可行的括号组合字符串。所谓合法,就是可以Valid Pare...
分类:其他好文   时间:2014-05-18 09:06:41    阅读次数:266
LeetCode: Merge k Sorted Lists [022]
【题目】 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 【题意】 合并K个有序链表 【思路】 归并 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For ...
分类:其他好文   时间:2014-05-18 09:05:40    阅读次数:255
LeetCode 017 4Sum
【题目】 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending ord...
分类:其他好文   时间:2014-05-18 08:46:04    阅读次数:227
LeetCode 013 Roman to Integer
【题目】 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 【题意】 把罗马数转换为整数 【思路】 罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。 大体思路是每个罗马字母对应的值相加即可, 但需要处理900, 400, 90, 40, 9, 4这几个特殊...
分类:其他好文   时间:2014-05-18 07:58:54    阅读次数:293
LeetCode: Letter Combinations of a Phone Number [018]
【题目】 Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf",...
分类:其他好文   时间:2014-05-18 07:30:12    阅读次数:340
LeetCode 014 Longest Common Prefix
【题目】 Write a function to find the longest common prefix string amongst an array of strings. 【题意】 求一组字符串的最长公共前缀 【思路】 使用归并思想求解 要求字符串[1,2,..,k,k+1,...n]的最大公共前缀,先分别求[1,2,...k]和[k+1,...,n]的公共前缀...
分类:其他好文   时间:2014-05-18 05:17:53    阅读次数:232
LeetCode 015 3Sum
【题目】 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) must be in non-descending order. (ie, a ≤ b ≤ c) The so...
分类:其他好文   时间:2014-05-18 03:15:50    阅读次数:287
461条   上一页 1 ... 42 43 44 45 46 47 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!