码迷,mamicode.com
首页 >  
搜索关键字:leetcode 19    ( 34993个结果
Leetcode | Palindrome
Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla...
分类:其他好文   时间:2014-05-12 16:27:07    阅读次数:332
【LeetCode】Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:其他好文   时间:2014-05-10 20:06:26    阅读次数:404
leetcode之Palindrome Partitioning
方法一:DFS递归,判断每一个是否为回文数1,首先要有一个判断字符串是否是回文的函数。容易实现,字符串从两边同时往中间走,看字符是否相同;2,深度优先搜索思想对字符串进行遍历。得到结果。例如,s = "abacd"; 需要对“a”“ad”“aba”“abac”“abacd”进行深度优先搜索。深度搜索...
分类:其他好文   时间:2014-05-06 00:52:34    阅读次数:388
[leetcode] Best Time to Buy and Sell Stock II
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2014-05-06 00:51:29    阅读次数:353
Leetcode | Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.想法很简单,就是两两合并。在Merge Two Sorted Lists这道题已经实现了两两合并的代码了,就...
分类:其他好文   时间:2014-05-06 00:22:01    阅读次数:337
LeetCode---Merge Intervals
题目链接区间合并,贪心,需要注意边界情况,LeetCode的数据还是比较好的,这样才能写出健壮的程序。附上代码: 1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * in...
分类:其他好文   时间:2014-05-06 00:16:44    阅读次数:400
LeetCode---Triangle
题目链接很简单的递推,但是写代码的过程中,犯了一个严重的错误,就是我用unsigned int型变量>= 0 作为循环条件(而且是降序)的时候,出现了问题。附上代码: 1 class Solution { 2 public: 3 int minimumTotal(vector > &tria...
分类:其他好文   时间:2014-05-06 00:10:57    阅读次数:335
【LeetCode】Sort Colors
LeetCode OJGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the or...
分类:其他好文   时间:2014-05-02 17:37:37    阅读次数:468
leetcode: Subsets & Subsets II
SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must...
分类:其他好文   时间:2014-05-02 16:39:15    阅读次数:315
leetcode: Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:其他好文   时间:2014-05-02 09:54:11    阅读次数:269
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!