![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 64
码农丸
这个作者很懒,什么都没留下…
展开
-
LeetCode 2. 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 return i原创 2017-04-01 01:08:53 · 290 阅读 · 0 评论 -
LeetCode 46. Permutations(同47,只是不包含重复数字)
Given a collection of distinct 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], [3,2,1]原创 2017-04-19 22:49:07 · 333 阅读 · 0 评论 -
LeetCode 47. Permutations II(生成不同的组合-dfs)
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], [2,1原创 2017-04-19 22:42:00 · 291 阅读 · 0 评论 -
LeetCode 48. Rotate Image 数组90度翻转(要求空间复杂度)
题目:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?我的方法:假设一个3维数组 0 1 2 3 0原创 2017-04-19 21:47:49 · 285 阅读 · 0 评论 -
LeetCode 49. Group Anagrams 找相同的字母组成的字符串
题目:Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]原创 2017-04-19 20:10:56 · 343 阅读 · 0 评论 -
LeetCode 38. Count and Say 字符串“阅读式”扩张
题目:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read原创 2017-04-19 19:28:05 · 229 阅读 · 0 评论 -
LeetCode 21. Merge Two Sorted Lists 两个有序列表合成一个
题目Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Subscribe to see which companies asked this原创 2017-04-19 17:50:27 · 382 阅读 · 0 评论 -
LeetCode 20. Valid Parentheses 判断()[]{}是否完整
Total Accepted: 189650Total Submissions: 576679Difficulty: EasyContributor: LeetCodeGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input stri原创 2017-04-19 17:07:17 · 176 阅读 · 0 评论 -
LeetCode 14. Longest Common Prefix 找字符串数组最长相同前缀
题目:Write a function to find the longest common prefix string amongst an array of strings.Subscribe to see which companies asked this question.public class Solution { public Strin原创 2017-04-19 14:49:40 · 278 阅读 · 0 评论 -
LeetCode 35. 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 order.You may assume no duplicates in the array.原创 2017-04-19 12:44:51 · 190 阅读 · 0 评论 -
LeetCode 13. Roman to Integer 罗马数字转整数
题目Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.按照说明书写代码:public class Solution {// 即Ⅰ(1)、X(10)、C(100)、M(1000)、V(5)、L(50)、D(50原创 2017-04-19 12:11:14 · 183 阅读 · 0 评论 -
LeetCode 50. Pow(x, n) x的n的次方
Implement pow(x, n).Subscribe to see which companies asked this question.public class Solution { public double myPow(double x, int n) { if(n==0) return 1; double mid = myPow原创 2017-04-13 22:57:29 · 250 阅读 · 0 评论 -
LeetCode 300.Longest Increasing Subsequence 在一维数组中找最长序列(好题)
题目Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101]原创 2017-04-13 02:45:09 · 290 阅读 · 0 评论 -
LeetCode 329. Longest Increasing Path in a Matrix 在二维数组中寻找最长递增序列
题目:Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move原创 2017-04-13 00:33:03 · 799 阅读 · 0 评论 -
LeetCode 9. Palindrome Number 判断是否为回文数
Determine whether an integer is a palindrome. Do this without extra space.题目解释:判断一个数是否为回文数,不能使用额外的空间注意:1.负数不能是回文数 2.如果转化为字符串进行处理就利用了额外的空间(If you are thinking of converting the integer to stri原创 2017-04-01 11:37:54 · 254 阅读 · 0 评论 -
LeetCode 7. Reverse Integer 整数反转
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321题目解释:将整数进行翻转,需要注意几个点:1.如果末尾是0怎么办,10反转就是12.带有正负号,-123反转是-3213.整数越界, 1534236469 反转 9646324351 超原创 2017-04-01 01:45:04 · 484 阅读 · 0 评论 -
LeetCode 15. 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: The solution set must not原创 2017-05-09 19:11:46 · 349 阅读 · 0 评论