leetcode
文章平均质量分 71
olarsu
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Combinations
好久没更新。最近主要忙几件事情:帮老师原创 2014-11-11 20:40:56 · 444 阅读 · 0 评论 -
Permutations
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].一遍通过!用的是递归的原创 2014-11-03 11:13:34 · 602 阅读 · 0 评论 -
Anagrams
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.原创 2014-11-03 19:25:48 · 388 阅读 · 0 评论 -
Jump Game II
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.Your goal is to原创 2014-10-17 15:16:49 · 385 阅读 · 0 评论 -
Permutations II
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].z原创 2014-11-03 11:39:54 · 468 阅读 · 0 评论 -
Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), d原创 2014-11-04 15:54:35 · 364 阅读 · 0 评论 -
Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may not e原创 2014-11-05 10:33:46 · 369 阅读 · 0 评论 -
Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""312"原创 2014-10-31 16:42:28 · 401 阅读 · 0 评论 -
Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?z这是一道简单题,类似于原创 2014-11-05 11:12:37 · 452 阅读 · 0 评论 -
Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination原创 2014-11-05 18:18:46 · 420 阅读 · 0 评论 -
Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number o原创 2014-11-05 17:10:46 · 418 阅读 · 0 评论 -
Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.这道问题是深层拷贝的问题。所谓的深层拷贝和浅层拷贝在于指针引用内原创 2014-11-25 19:53:04 · 408 阅读 · 0 评论 -
Decode Ways
package leetcode;public class test {/* * A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message co原创 2015-02-16 22:40:14 · 377 阅读 · 0 评论 -
Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", return fals原创 2015-03-02 20:04:15 · 333 阅读 · 0 评论 -
Merge Intervals
import java.util.ArrayList;import java.util.List;import javax.swing.text.StyledEditorKit.ForegroundAction;public class Merge_Intervals { /** * Given a collection of intervals, merge all overl原创 2014-10-17 17:43:57 · 438 阅读 · 0 评论 -
2014-10-17
昨天帮老师搬办公室,然后就荒废了原创 2014-10-17 11:24:24 · 424 阅读 · 0 评论 -
Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100"z这是一道原创 2014-11-03 12:12:04 · 480 阅读 · 0 评论 -
2014-10-27
过去一周没有写letcode。原因是备战原创 2014-10-27 18:07:08 · 325 阅读 · 0 评论 -
String to Integer (atoi)
经典的atoi函数写起来还真是大费周折。atoi原创 2014-10-27 20:29:13 · 374 阅读 · 0 评论 -
Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link原创 2014-10-27 22:21:38 · 334 阅读 · 0 评论 -
Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now [1,1,2,2,3]这一原创 2014-10-28 16:59:06 · 326 阅读 · 0 评论 -
Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.这是第一道完全在web中写并且提交并且原创 2014-10-28 17:26:53 · 350 阅读 · 0 评论 -
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原创 2014-10-29 16:29:33 · 344 阅读 · 0 评论 -
three sum 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原创 2014-10-29 16:42:07 · 391 阅读 · 0 评论 -
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1->1->原创 2014-10-29 10:14:24 · 372 阅读 · 0 评论 -
Remove Duplicates from Sorted Array
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 c原创 2014-10-28 16:16:13 · 339 阅读 · 0 评论 -
candy
There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least one ca原创 2014-10-30 16:19:12 · 336 阅读 · 0 评论 -
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 qu原创 2014-10-29 19:15:10 · 342 阅读 · 0 评论 -
2014-10-15工作
昨天把短信侦听给完成了。主要参考了两三篇文章:原创 2014-10-15 21:33:57 · 409 阅读 · 0 评论 -
Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two原创 2014-11-19 12:05:30 · 385 阅读 · 0 评论 -
Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which原创 2015-03-03 21:10:05 · 437 阅读 · 0 评论
分享