leetcode
文章平均质量分 64
dream天空
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode之Word-break
题目Word-breakGiven a string s and a dictionary of wordsdict, determine if s can be segmented into a space-separated sequence of one ormore dictionary words.For example, givens ="leetcode",d原创 2017-08-13 11:10:50 · 378 阅读 · 0 评论 -
leetcode之add two numbers
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and原创 2018-02-07 17:09:04 · 287 阅读 · 0 评论 -
打气球游戏
题目:打气球游戏Given n balloons, indexed from 0 to n-1.Each balloon is painted with a number on it represented by array nums. You areasked to burst all the balloons. If the you burst balloon i you will get原创 2017-09-12 18:58:21 · 1138 阅读 · 0 评论 -
数串
题目描述设有n个正整数,将他们连接成一排,组成一个最大的多位整数。如:n=3时,3个整数13,312,343,连成的最大整数为34331213。如:n=4时,4个整数7,13,4,246连接成的最大整数为7424613。输入描述:有多组测试样例,每组测试样例包含两行,第一行为一个整数N(N输出描述:每组数据输出一个表示最大的整数。示例1输入212 123原创 2017-09-03 15:12:31 · 284 阅读 · 0 评论 -
leetcode之surrounded-regions
题目Given a 2D board containing'X'and'O',capture all regions surrounded by'X'.A region is captured by flipping all'O'sinto'X's in that surrounded region .For example,X X X XX O O XX X O XX原创 2017-09-03 11:21:13 · 271 阅读 · 0 评论 -
Leetcode之Longest Consecutive Sequence
[LeetCode] Longest Consecutive Sequence 求最长连续序列Given an unsorted array of integers, findthe length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The lon原创 2017-09-01 22:09:03 · 295 阅读 · 0 评论 -
leetcode之TwoSum[Java]
题目Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums =原创 2017-09-16 18:35:43 · 275 阅读 · 0 评论 -
栈的压入、弹出序列
题目:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不可能是该压栈序列的弹出序列。(注意:这两个序列的长度是相等的)实现:public class Solution { public b原创 2017-09-14 09:45:28 · 282 阅读 · 0 评论 -
leetcode之subset II
题目Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain dup原创 2017-09-05 21:48:36 · 334 阅读 · 0 评论 -
最大连续子数组的和
问题给定一个整数数组,数组里可能有正数、负数和零。数组中连续的一个或多个整数组成一个子数组,每个子数组都有一个和。求所有子数组的和的最大值。例如,如果输入的数组为{1,-2,3,10,-4,7,2,-5},和最大的子数组为{3,10,-4,7,2},那么输出为该子数组的和18。实现public class MaxSubArray {public static void main原创 2017-08-22 16:11:33 · 384 阅读 · 0 评论 -
Unique Paths II
题目Follow up for "Unique Paths":Now consider if some obstacles are added tothe grids. How many unique paths would there be?An obstacle and empty space is markedas1and0respectively in the grid.F原创 2017-08-24 22:30:52 · 239 阅读 · 0 评论 -
统计字符
题目描述给定一个英文字符串,请写一段代码找出这个字符串中首先出现三次的那个英文字符。输入描述:输入数据一个字符串,包括字母,数字等。输出描述:输出首先出现三次的那个英文字符示例1输入Have you ever gone shopping and输出E实现 public class Main { publicstatic void原创 2017-08-24 21:10:49 · 336 阅读 · 0 评论 -
删除公共字符
题目描述输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。例如,输入”Theyare students.”和”aeiou”,则删除之后的第一个字符串变成”Thy r stdnts.”输入描述:每个测试输入包含2个字符串输出描述:输出删除后的字符串示例1输入They are students.aeiou输出Thy r stdnts.实现i原创 2017-08-24 20:29:28 · 370 阅读 · 0 评论 -
寻找和为定值的n个数
寻找和为定值的N个数题目:输入两个整数n和sum,要求从数列1, 2, 3, ...,n中随意取出几个数,使得它们的和等于sum,请将其中所有可能的组合列出来。思路:上述问题是典型的背包问题的应用,即先找出n个数的所有组合,再在这些组合中寻找组合数相加之和等于sum的组合,并依次输出这些组合中的数。实现:public class ManySumN {原创 2017-08-14 16:20:25 · 820 阅读 · 0 评论 -
leetcode之candy
题目:There are N children standing ina line. Each child is assigned a rating value.You are giving candies to these childrensubjected to the following requirements:Each child musthave at least one原创 2017-08-13 21:12:15 · 252 阅读 · 0 评论 -
leetcode之压缩字符串中的重复字符
题目通过键盘输入一串小写字母(a~z)组成的字符串。请编写一个字符串压缩程序,将字符串中连续出现的重复字母进行压缩,并输出压缩后的字符串。压缩规则:1、仅压缩连续重复出现的字符。比如字符串”abcbc”由于无连续重复字符,压缩后的字符串还是”abcbc”。2、压缩字段的格式为”字符重复的次数+字符”。例如:字符串”xxxyyyyyyz”压缩后就成为”3x6yz”。原创 2017-08-13 16:25:07 · 1991 阅读 · 0 评论 -
leetcode
题目:Given a string, find the length of the longest substring without repeating characters.例子:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer i原创 2018-02-07 17:43:33 · 286 阅读 · 0 评论
分享