![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode-en
文章平均质量分 54
告别婴儿肥
在读大学生
展开
-
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 · 60 阅读 · 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 · 121 阅读 · 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 · 102 阅读 · 0 评论 -
9. Palindrome Number
中午去图书馆,有插座的座位都被占了,看我的y7000p能抗多久。。。Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward.Example 1:Input: 121Output: trueExample...原创 2018-12-09 12:12:25 · 81 阅读 · 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 · 168 阅读 · 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: 21No...原创 2018-12-08 18:28:18 · 87 阅读 · 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 · 117 阅读 · 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 · 103 阅读 · 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 · 95 阅读 · 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 · 113 阅读 · 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 · 116 阅读 · 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 · 77 阅读 · 0 评论 -
12. Integer to Roman
最近发现CSDN上的垃圾信息太多了,一些兄弟什么玩意都往上边贴,搞得遇到问题检索时将优质答案隐没在了茫茫大海之中,效率太低,以及拷贝严重。Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V ...原创 2018-12-14 20:13:49 · 116 阅读 · 0 评论