随笔分类 - LeetCode
摘要:题目: LeetCode: [18. 4Sum][1] 描述: 分析: 代码: 备注: 感觉方法不是特别好,后续可能在投入时间在思考,LC Discuss上应该有更高效的方法。欢迎大家指正。 tip: 1、[15. 3Sum][2]以及[16. 3Sum Closest][3]; 2、[unorde
阅读全文
摘要:题目: LeetCode: [17. Letter Combinations of a Phone Number][1] 描述: 分析: 代码: 备注: 可以参考 cinderella_niu的博客[LeetCode: 87 Letter Combinations of a Phone Number
阅读全文
摘要:题目: LeetCode: [16. 3Sum Closest][1] 描述: 分析: 本题思路和[15. 3Sum][2]基本上一致的。 代码: 备注: 可以参考[15. 3Sum][2]. [1]: https://leetcode.com/problems/3sum closest/ /des
阅读全文
摘要:题目: LeetCode: [15. 3Sum][1] 描述: 分析: 代码: c++ vector threeSum(vector& vecNum) { vector vecRes; if (vecNum.size() ::iterator iterBg = vecNum.begin(); ite
阅读全文
摘要:题目: LeetCode: [14. Longest Common Prefix][1] 描述: 分析: 代码: c++ / @brief: @param[in]: strs,The string to be processed return: the common string / string
阅读全文
摘要:题目: LeetCode: [13. Roman to Integer][1] 描述: 题意为 给定一个罗马数字转换为整数(1 3999)输出。 分析: 代码: c++ int romanToInt(string s) { int nRes = 0; int nLen = s.length(); f
阅读全文
摘要:题目: LeetCode: [12. Integer to Roman][1] 描述: 题意为 给定一个整数(1 3999)转换为罗马数字输出。 分析: 暴力方式 进制思路 代码: 思路一:暴力方式 思路二:进制思路 备注: 1. [罗马数字的百科介绍][2] 2. [罗马数字“ 0”的存在][3]
阅读全文
摘要:题目: LeetCode: [11. Container With Most Water][1] 描述: 1. 从已有的数组中,选找两个线段使得他能构成最大的盛水容器。 2. 盛水容器,根据生活常识,容量取决于最短的那条边; 3. 盛水容量为: S = a(长) b(宽) = min(i , j)
阅读全文
摘要:题目: LeetCode: [10. Regular Expression Matching][1] 描述: Implement regular expression matching with support for '.' and ' '. 大体意思和正则匹配很相似,但不同的是 是匹配前一个字符
阅读全文
摘要:题目: Leetcode: [ 9. Palindrome Number ][1] 描述: 内容:Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative
阅读全文
摘要:7. Reverse Integer 题目: Leetcode: [7. Reverse Integer][1] 描述: 内容:Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = 123, return
阅读全文
摘要:LeetCode : ZigZag Conversion 题目: LeetCode: [6. ZigZag Conversion][1] 描述: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number
阅读全文
摘要:题目: LeetCode:[1. Add Two Numbers][1] 描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You
阅读全文
摘要:题目: LeetCode:[2. Add Two Numbers][1] 描述: You are given two non empty linked lists representing two non negative integers. The digits are stored in rev
阅读全文
摘要:LeetCode:60. Permutation Sequence,n全排列的第k个子列 : 题目: LeetCode: [ 60. Permutation Sequence][1] 描述: The set [1,2,3,…,n] contains a total of n! unique perm
阅读全文
浙公网安备 33010602011771号