- 博客(8)
- 收藏
- 关注
原创 leetcode394:字符串解码
定一个经过编码的字符串,返回它解码后的字符串。 编码规则为: k[encoded_string],表示其中方括号内部的 encoded_string 正好重复 k 次。注意 k 保证为正整数。 你可以认为输入字符串总是有效的;输入字符串中没有额外的空格,且输入的方括号总是符合格式要求的。 此外,你可以认为原始数据不包含数字,所有的数字只表示重复的次数 k ,例如不会出现像 3a 或 2[4] 的输入。 eg: 输入:s = “3[a]2[bc]” 输出:“aaabcbc” 输入:s = “3[a2[c]
2021-01-24 19:24:31
118
1
原创 leetcode300: Longest Increasing Subsequence
Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Input: [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4. solution 1: 动态规划(无序) class So
2020-11-15 21:28:22
103
原创 LeetCode279. Perfect Squares
题目:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n. Example 1: Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2: Input: n = 13 Output: 2 Explanation: 13 = 4 + 9. 方法一:动态规
2020-09-13 12:19:00
122
原创 leetcode5: Longest Palindromic Substring
题目: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. 求字符串中最长的回文子串。对字符串中的每一个字符,判断其是否为回文子串的中心字符。这里分为两种类型来判断。一种是含有奇数个字符的回文字符串,如"aba";另一种是含有偶数个字符的回文子串,如"bb";需要注意的是, 有可能字符串会同时满足两种情况, 如"baaaaa"。
2020-08-09 20:15:36
120
原创 leetcode198: House Robber
题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automati
2020-07-18 23:03:09
96
原创 leetcode_152: Maximum Product Subarray
题目:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: Input: [2,3,-2,4] Output: 6 Explanation: [2,3] has the largest product 6. Example 2: Input: [-2,0,-1] Ou
2020-07-14 16:51:25
82
原创 Anti-Aliasing
MSAA:(MultiSampling Anti-Aliasing), 通过提取像素界面周围的颜色信息,通过混合颜色信息来消除高对比界面所产生的锯齿。只对多边形的边缘进行抗锯齿处理。 MSAA的做法也很容易理解,我们依然同样会分采样点,但是只会去计算究竟有几个采样点会被三角形cover,计算颜色的时候只会利用像素中心坐标计算一次颜色(即所有的信息都会被插值到像素中心然后取计算颜色),如下图: FXAA:(Fast Approximately -Aliasing), FXAA原理与MSAA相同,其原理是通过
2020-06-30 10:30:01
354
原创 leetcode_142:Linked List Cycle
leetcode_142:Linked List Cycle 题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked l
2020-06-28 19:57:44
3095
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人