
leetcode-en
文章平均质量分 52
告别婴儿肥
在读大学生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1. Two Sum
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, and you may not use the same ...原创 2018-11-25 13:29:26 · 100 阅读 · 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...原创 2018-12-09 15:04:10 · 173 阅读 · 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 c...原创 2018-12-09 14:40:14 · 146 阅读 · 0 评论 -
9. Palindrome Number
中午去图书馆,有插座的座位都被占了,看我的y7000p能抗多久。。。 Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward. Example 1: Input: 121 Output: true Example...原创 2018-12-09 12:12:25 · 119 阅读 · 0 评论 -
8. String to Integer (atoi)
做这道题刚才踩了第7题留下的坑,233,加深了对第7题理解。也学会了对数组越界的一种判断方法 Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whites...原创 2018-12-08 20:16:44 · 211 阅读 · 0 评论 -
7. Reverse Integer
这几天在公司实习,感觉进步缓慢,焦虑中 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 No...原创 2018-12-08 18:28:18 · 122 阅读 · 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...原创 2018-12-02 20:01:14 · 154 阅读 · 0 评论 -
5. Longest Palindromic Substring
为了快速提高自己的水平,多看好的风格的代码,防止闭门造车。 Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000. Example 1: Input: "babad" Output: "bab...原创 2018-12-02 19:05:05 · 141 阅读 · 0 评论 -
4. Median of Two Sorted Arrays
做这道题花费了个人大量时间,但做出来之后就觉得没那么难了,之前的思路,主要是对边界值的处理感觉太复杂理不清。以下思路在边界值方面更不容易搞混淆 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The ove...原创 2018-12-02 17:14:07 · 135 阅读 · 0 评论 -
217. Contains Duplicate
今天刷 leetcode "4. Median of Two Sorted Arrays",半天没看懂log(m +n) 算法的具体细节,十分懊恼,做一道简单题放松一下。这道题去北邮面试的时候还考过,当初直接用一个数组s,用index存input数组的值,用s[index] ,存储对应的下标,如果发现s[index]不是0,则说明已经出现,故重复。(默认index从1开始) Given an ...原创 2018-12-02 15:36:48 · 147 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: ...原创 2018-11-25 14:05:14 · 153 阅读 · 0 评论 -
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...原创 2018-11-25 13:33:33 · 122 阅读 · 0 评论 -
12. Integer to Roman
最近发现CSDN上的垃圾信息太多了,一些兄弟什么玩意都往上边贴,搞得遇到问题检索时将优质答案隐没在了茫茫大海之中,效率太低,以及拷贝严重。 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V ...原创 2018-12-14 20:13:49 · 159 阅读 · 0 评论