
LeetCode 刷刷刷
每周来几道,保持思路,不要荒废。
ltree98
游戏开发者
展开
-
[Leetcode]_47 Permutations II
/** * Index: 47 * Title: Permutations II * Author: ltree98 **/题意给定一组数,输出这些数的全排列(可能会有相同的数字)我的思路上一道题,是针对不同数的全排列,这道就是进阶版,含有相同数字的全排列。那么,理论上来讲,只需要把重复的部分去掉就行了,我是在上题基础上,在每次底层循环时候进行的剪枝,并没有在最终处剪...原创 2018-12-01 11:50:49 · 235 阅读 · 0 评论 -
[Leetcode]_46 Permutations
/** * Index: 46 * Title: Permutations * Author: ltree98 **/题意给定一组不同的数,输出这些数的全排列。我的思路先说方法 —— 递归,由于题目说了是不同数字,所以不用考虑数字相同的情况。求 [1, 2, 3] 全排列,先求 [2, 3] 全排列,再将 1 插入到 [2, 3] 全排列的各个位置。直到所求...原创 2018-11-10 00:19:58 · 300 阅读 · 0 评论 -
[Leetcode]_45 Jump Game II
/** * Index: 45 * Title: Jump Game II * Author: ltree98 **/题意给定一组非负整数;从第一个索引开始向后走,数组索引对应的值代表最多可以走的步数;求到达最后索引最少要走几次?我的思路贪个心,我每次要走最远,代表我索引值与索引指向的值和要最大。再特殊处理一下空值。时间复杂度: O(n)空间复杂度: O(...原创 2018-11-04 23:42:48 · 273 阅读 · 0 评论 -
[Leetcode]_44 Wildcard Matching
/** * Index: 44 * Title: Wildcard Matching * Author: ltree98 **/题意字符串匹配Note:‘?’ 可匹配任意一个字符(且必须匹配一个字符)‘*’ 可匹配任意长度字符(包括空串)我的思路动态规划,二维数组,以s串为行,p串为列;dp[i][j] 表示 0i的s串能否与0j的p串匹配成功。推倒公...原创 2018-10-28 21:28:43 · 262 阅读 · 0 评论 -
[Leetcode]_43 Multiply Strings
/** * Index: 43 * Title: Multiply Strings * Author: ltree98 **/题意大数乘法Note:两个数的长度均小于110两个数只包含数字0-9两个数没有前缀0,除非0本身不需使用内置大数或直接将数转换为整型我的思路模拟乘法的计算,将数1分别与数2的个十百千万…位计算;每计算完一个位数,将得到的数汇总到...原创 2018-09-26 23:45:01 · 270 阅读 · 0 评论 -
[Leetcode]_42 Trapping Rain Water
/** * Index: 42 * Title: Trapping Rain Water * Author: ltree98 **/题意:求n个柱子的储水体积。给的n个正数代表每个柱子的高度。思路:从第一个柱子开始,找到下一个高度大于等于该柱子高度的柱子,然后求这两根柱子间的储水体积;再以该柱子为基准,继续向后找大于等于该柱子高度的柱子。经过一轮遍历,找到了最高...原创 2018-09-21 00:46:54 · 273 阅读 · 0 评论 -
[Leetcode]_41 First Missing Positive
Leetcode_41 First Missing Positive原创 2017-09-03 22:46:37 · 841 阅读 · 0 评论 -
[Leetcode]_40 Combination Sum II
Leetcode_40 Combination Sum II原创 2017-08-27 11:48:24 · 719 阅读 · 0 评论 -
[Leetcode]_39 Combination Sum
Leetcode_39 Combination Sum原创 2017-08-27 11:38:54 · 638 阅读 · 3 评论 -
[Leetcode]_38 Count and Say
Leetcode_38 Count and Say原创 2017-07-30 21:12:28 · 852 阅读 · 0 评论 -
[Leetcode]_37 Sudoku Solver
Leetcode_37 Sudoku Solver原创 2017-07-30 20:59:02 · 795 阅读 · 0 评论 -
[Leetcode]_36 Valid Sudoku
Leetcode_36 Valid Sudoku原创 2017-07-30 20:47:27 · 635 阅读 · 0 评论 -
[Leetcode]_35 Search Insert Position
Leetcode_35 Search Insert Position原创 2017-07-13 22:55:01 · 884 阅读 · 0 评论 -
[Leetcode]_34 Search for a Range
Leetcode_34 Search for a Range原创 2017-07-09 18:45:56 · 753 阅读 · 0 评论 -
[Leetcode]_33 Search in Rotated Sorted Array
Leetcode_33 Search in Rotated Sorted Array原创 2017-06-09 23:13:20 · 771 阅读 · 0 评论 -
[Leetcode]_32 Longest Valid Parentheses
Leetcode_32 Longest Valid Parentheses原创 2017-06-06 23:28:56 · 705 阅读 · 0 评论 -
[Leetcode]_31 Next Permutation
Leetcode_31 Next Permutation原创 2017-06-04 14:41:39 · 633 阅读 · 0 评论 -
[Leetcode]_30 Substring with Concatenation of All Words
Leetcode_30 Substring with Concatenation of All Words原创 2017-05-30 19:20:37 · 391 阅读 · 0 评论 -
[Leetcode]_29 Divide Two Integers
Leetcode_29 Divide Two Integers原创 2017-05-25 23:15:01 · 768 阅读 · 0 评论 -
[Leetcode]_28 Implement strStr()
Leetcode_28 Implement strStr()字符串模式匹配 BF KMP原创 2017-05-21 22:09:48 · 955 阅读 · 0 评论 -
[Leetcode]_27 Remove Element
Leetcode_27 Remove Element原创 2017-05-15 22:15:32 · 700 阅读 · 0 评论 -
[Leetcode]_26 Remove Duplicates from Sorted Array
Leetcode_26 Remove Duplicates from Sorted Array原创 2017-05-13 21:11:26 · 910 阅读 · 0 评论 -
[Leetcode]_25 Reverse Nodes in k-Group
Leetcode_25 Reverse Nodes in k-Group原创 2017-05-10 22:58:32 · 781 阅读 · 0 评论 -
[Leetcode]_24 Swap Nodes in Pairs
Leetcode_24 Swap Nodes in Pairs原创 2017-05-08 21:42:42 · 978 阅读 · 0 评论 -
[Leetcode]_23 Merge k Sorted Lists
Leetcode_23 Merge k Sorted Lists原创 2017-05-07 12:07:55 · 771 阅读 · 0 评论 -
[Leetcode]_1 Two Sum
[Leetcode]_1 Two Sum原创 2017-03-14 22:43:32 · 634 阅读 · 0 评论 -
[Leetcode]_2 Add Two Numbers
Leetcode_2 Add Two Numbers简单题原创 2017-03-15 22:11:30 · 651 阅读 · 0 评论 -
[Leetcode]_3 Longest Substring Without Repeating Characters
Leetcode3 Longest Substring Without Repeating Characters原创 2017-03-16 21:42:32 · 535 阅读 · 0 评论 -
[Leetcode]_4 Median of Two Sorted Arrays
Leetcode_4 Median of Two Sorted Arrays分治法原创 2017-03-20 22:15:44 · 690 阅读 · 0 评论 -
[Leetcode]_5 Longest Palindromic Substring
leetcode_5 Longest Palindromic SubstringDP原创 2017-03-21 22:36:58 · 682 阅读 · 0 评论 -
[Leetcode]_6 ZigZag Conversion
Leetcode_6 ZigZag Conversion模拟法,找规律原创 2017-03-27 22:47:05 · 850 阅读 · 0 评论 -
[Leetcode]_7 Reverse Integer
Leetcode_7 Reverse Integer原创 2017-03-23 22:58:33 · 671 阅读 · 0 评论 -
[Leetcode]_8 String to Integer(atoi)
Leetcode_8 String to Integer(atoi)简单题原创 2017-03-28 22:18:23 · 581 阅读 · 0 评论 -
[Leetcode]_9 Palindrome Number
Leetcode_9 Palindrome Number原创 2017-03-30 22:36:08 · 413 阅读 · 0 评论 -
[Leetcode]_10 Regular Expression Matching
Leetcode_10 Regular Expression Matching原创 2017-04-01 15:33:43 · 350 阅读 · 0 评论 -
[Leetcode]_11 Container With Most Water
Leetcode_11 Container With Most Water原创 2017-04-05 22:10:45 · 340 阅读 · 0 评论 -
[Leetcode]_12 Integer to Roman
Leetcode_12 Integer to Roman原创 2017-04-05 22:18:35 · 458 阅读 · 0 评论 -
[Leetcode]_13 Roman to Integer
Leetcode_13 Roman to Integer原创 2017-04-10 22:01:44 · 327 阅读 · 0 评论 -
[Leetcode]_14 Longest Common Prefix
Leetcode_14 Longest Common Prefix原创 2017-04-12 23:08:14 · 482 阅读 · 0 评论 -
[Leetcode]_15 3Sum
Leetcode_15 3Sum原创 2017-04-17 23:36:45 · 483 阅读 · 0 评论