随笔分类 -  ~~Leetcode~~

摘要: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].题目的意思是将相交得区间合并... 阅读全文
posted @ 2014-07-05 16:31 OpenSoucre 阅读(133) 评论(0) 推荐(0)
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana... 阅读全文
posted @ 2014-07-04 23:32 OpenSoucre 阅读(154) 评论(0) 推荐(0)
摘要:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.题目的意思是:给出一组字符串,按组返回拥有相同变位词的字符串解题思路是: ... 阅读全文
posted @ 2014-07-04 21:40 OpenSoucre 阅读(124) 评论(0) 推荐(0)
摘要:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati... 阅读全文
posted @ 2014-07-04 18:26 OpenSoucre 阅读(322) 评论(0) 推荐(0)
摘要:Divide two integers without using multiplication, division and mod operator.不用乘、除、求余操作,返回两整数相除的结果,结果也是整数。假设除数是2,相除的商就是被除数二进制表示向右移动一位。假设被除数是a,除数是b,因为不知... 阅读全文
posted @ 2014-07-04 17:54 OpenSoucre 阅读(157) 评论(0) 推荐(0)
摘要:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol... 阅读全文
posted @ 2014-07-04 17:03 OpenSoucre 阅读(174) 评论(0) 推荐(0)
摘要:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2014-07-04 13:06 OpenSoucre 阅读(199) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2014-07-04 12:04 OpenSoucre 阅读(239) 评论(0) 推荐(0)
摘要:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2014-07-04 11:44 OpenSoucre 阅读(246) 评论(0) 推荐(0)
摘要:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2014-07-04 11:18 OpenSoucre 阅读(209) 评论(0) 推荐(0)
摘要:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2014-07-04 10:55 OpenSoucre 阅读(179) 评论(0) 推荐(0)
摘要:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi... 阅读全文
posted @ 2014-07-04 10:32 OpenSoucre 阅读(128) 评论(0) 推荐(0)
摘要: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 maximu... 阅读全文
posted @ 2014-07-04 10:13 OpenSoucre 阅读(207) 评论(0) 推荐(0)
摘要: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 maximu... 阅读全文
posted @ 2014-07-04 09:56 OpenSoucre 阅读(240) 评论(0) 推荐(0)
摘要:题目的意思就是将十进制转换成格雷码首先将二进制转换成格雷码根据此图可以看出二进制的第i和第i+1位异或为格雷码的第i+1位,对于给定的十进制数x,其(x>>1)相当于二进制向右移动一位将 x^(x>>1)刚好能按照上述方式完成异或,故结果为x的格雷码class Solution {public: ... 阅读全文
posted @ 2014-07-03 22:29 OpenSoucre 阅读(145) 评论(0) 推荐(0)
摘要:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文
posted @ 2014-07-03 21:47 OpenSoucre 阅读(190) 评论(0) 推荐(0)
摘要:Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig... 阅读全文
posted @ 2014-07-03 20:42 OpenSoucre 阅读(214) 评论(0) 推荐(0)
摘要:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2014-07-03 20:14 OpenSoucre 阅读(152) 评论(0) 推荐(0)
摘要:Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem stat... 阅读全文
posted @ 2014-07-03 18:05 OpenSoucre 阅读(319) 评论(0) 推荐(0)
摘要:Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2014-07-03 17:35 OpenSoucre 阅读(215) 评论(0) 推荐(0)