![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
hwb1992
这个作者很懒,什么都没留下…
展开
-
LeetCode|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-04-16 21:54:20 · 777 阅读 · 0 评论 -
LeetCode|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原创 2014-04-12 13:26:07 · 803 阅读 · 0 评论 -
LeetCode|Linked List Cycle
题目Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路 通过快慢指针来做.如果存在环,那么通过快慢指针,一定可以让快指针指向满指针(并且快指针指向的当前位置和下一个位置都不是null但是如果不存在环原创 2014-04-12 14:46:28 · 768 阅读 · 0 评论 -
LeetCode|AddBinary
题目Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".思路恩..其实这道题可以简单点的,用BigInteger来做..比较恶心..但是还是乖点,用标准的做法吧分析: 2个二进原创 2014-04-11 22:10:24 · 721 阅读 · 0 评论 -
LeetCode|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:Ele原创 2014-04-09 21:05:45 · 740 阅读 · 0 评论 -
LeetCode|2Sum
题目Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target,原创 2014-04-07 22:27:11 · 767 阅读 · 0 评论 -
LeetCode|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,原创 2014-04-09 13:04:57 · 840 阅读 · 0 评论 -
LeetCode|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 e原创 2014-04-09 16:38:58 · 779 阅读 · 0 评论 -
LeetCode|Substring with Concatenation of All Words
题目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 concatenation of each word in L exactly once and with原创 2014-04-23 14:43:54 · 935 阅读 · 0 评论 -
LeetCode|Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each原创 2014-04-07 20:00:21 · 765 阅读 · 0 评论 -
LeetCode|Anagrams
题目Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.思路这个题目是判断所给的字符串数组中是否存在重复的颠倒字符串.解决思路如下首先为每个字符串排序 -->这个是用来判断是否存在重复的颠倒原创 2014-04-20 22:25:04 · 775 阅读 · 0 评论 -
LeetCode|Evaluate Reverse Polish Notation
题目Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1"原创 2014-04-20 21:26:47 · 762 阅读 · 0 评论 -
LeetCode|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原创 2014-04-20 20:31:28 · 738 阅读 · 0 评论 -
LeetCode|Linked List Cycle II
题目Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?思路本来我傻傻的用 Linked List Cycle 的方法来做,原创 2014-04-12 20:05:52 · 2493 阅读 · 0 评论