算法
文章平均质量分 56
z89135898
这个作者很懒,什么都没留下…
展开
-
1.Two Sum
题目来源https://leetcode.com/problems/two-sum/description/给定一个数字,输入一个目标值,假设这个目标值等于数组中两个数相加,并且数组中的数字不重复。找到数字中两个数相加等于目标值的数,并返回索引。解题思路,最容易想到的是两层循环,找到两个相加等于目标值的数,实际开发中第一目标就是实现需求,那么我们就先把这个需求实现一下。fu原创 2018-01-23 13:26:43 · 170 阅读 · 0 评论 -
13. Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 5...原创 2018-05-16 14:57:57 · 164 阅读 · 0 评论 -
15. 3Sum
Given an array nums of n integers, are there elements a, b, c in nums 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 contain ...原创 2018-05-22 17:23:16 · 136 阅读 · 0 评论 -
12. Integer to Roman
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 5...原创 2018-05-15 17:13:12 · 144 阅读 · 0 评论 -
11. 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 ...原创 2018-05-15 15:41:57 · 139 阅读 · 0 评论 -
5. Longest Palindromic Substring (一)
5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "ab...原创 2018-05-10 12:24:54 · 120 阅读 · 0 评论 -
10. Regular Expression Matching
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The...原创 2018-05-11 13:05:26 · 438 阅读 · 0 评论 -
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation: F...原创 2018-05-10 17:07:53 · 146 阅读 · 0 评论 -
5. Longest Palindromic Substring (二)
5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "ab...原创 2018-05-10 13:15:26 · 116 阅读 · 0 评论 -
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this ...原创 2018-05-10 16:09:53 · 186 阅读 · 0 评论 -
7. Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with an envir...原创 2018-05-10 14:58:37 · 93 阅读 · 0 评论 -
6. ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I G...原创 2018-05-10 14:47:38 · 106 阅读 · 0 评论 -
4. Median of Two Sorted Arrays(一)
题目来源https://leetcode.com/problems/median-of-two-sorted-arrays/description/给出两个有序数组,找到两个数组的中位数。解题思路,先不去考虑时间复杂度,时间需求才是第一要务不是?如果这样最简单的做法就是先将两个有序数组合并成一个有序数组,之后计算时间复杂度就简单了,那么开始撸码吧。fun findMedianSortedArray...原创 2018-04-19 13:46:57 · 131 阅读 · 0 评论 -
2. Add Two Numbers
题目来源https://leetcode.com/problems/add-two-numbers/description/给你两个非空链表,表示两个非负整数,这些数字以相反的顺序存储,每个节点包含一个数字,添加两个数字并将其作为一个链表返回。你可以假设这两个数字不包含任何前导零,除了数字0本身。解题思路,还是一样的先解题,不是最优解和没有解出来差距可是比最优解和不原创 2018-01-23 14:58:46 · 136 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
题目来源https://leetcode.com/problems/longest-substring-without-repeating-characters/description/给定一个字符串,找出最长非重复字符串解题思路,比较耿直一点的写法,循环每一个字节,并用一个变量接受,直到遇到重复的字节,与上一次的进行长度对比,记录下较大的一个长度。fun lengthOfLo原创 2018-01-23 16:03:45 · 139 阅读 · 0 评论 -
14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "".Example 1:Input: ["flower","flow","flight"]Output: "fl"E...原创 2018-05-16 15:28:06 · 133 阅读 · 0 评论