Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: Input: [1,3,5,4,7] Output: 3 ...
分类:
其他好文 时间:
2019-12-15 10:28:00
阅读次数:
70
取得第一个做样板,然后与第二个字符串比较,看它们是否有共同前缀,没有那么将前缀的缩短一点,从后面砍掉一个字符再比较,有了前缀就再与第三,第四个比较 javascript function longestCommonPrefix(strs) { if (strs.length == 0) return ...
分类:
其他好文 时间:
2019-12-14 22:47:38
阅读次数:
80
485. Max Consecutive Ones Easy Easy Easy Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1 ...
分类:
其他好文 时间:
2019-12-14 09:25:04
阅读次数:
75
原题链接在这里:https://leetcode.com/problems/swap-for-longest-repeated-character-substring/ 题目: Given a string text, we are allowed to swap two of the charac ...
分类:
其他好文 时间:
2019-12-08 10:58:19
阅读次数:
129
链接: https://codeforces.com/contest/1265/problem/D 题意: An integer sequence is called beautiful if the difference between any two consecutive numbers is ...
分类:
其他好文 时间:
2019-12-07 01:19:52
阅读次数:
89
链接: https://codeforces.com/contest/1265/problem/A 题意: A string is called beautiful if no two consecutive characters are equal. For example, "ababcb", ...
分类:
其他好文 时间:
2019-12-07 01:04:48
阅读次数:
147
传送门:https://leetcode.com/problems/longest-valid-parentheses/ 题意:给出一个由括号'('与')'组成的字符串,找出最长合法连续子串的长度 思路:首先需要注意的是,子串要是连续的,然后按顺序一个'('匹配一个')',比如"()()()","( ...
分类:
其他好文 时间:
2019-11-30 23:59:23
阅读次数:
127
经典的动态规划题目:最长公共子序列(Longest Common Subsequence),使用二维数组记录,双层循环。 ...
分类:
其他好文 时间:
2019-11-23 23:43:06
阅读次数:
115
class Solution: def longestUnivaluePath(self, root: TreeNode) -> int: self.ans=0 def arrow_length(node): if not node: return 0 left_length=arrow_lengt ...
分类:
其他好文 时间:
2019-11-21 20:01:14
阅读次数:
60
File artical.txt contains an article in English (please create the file by yourself and put any English article you picked in it). Assume the article ...
分类:
其他好文 时间:
2019-11-20 13:06:23
阅读次数:
67