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
原题链接在这里: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
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example ...
分类:
其他好文 时间:
2019-12-07 12:18:43
阅读次数:
81
Redis缓存 @[toc] 简介 redis是一个高性能的key value数据库 优势 性能强,适合高度的读写操作(读的速度是110000次/s,写的速度是81000次/s )。 支持较为丰富的数据类型(如二进制的Strings, Lists, Hashes, Sets ,Ordered Set ...
分类:
编程语言 时间:
2019-12-03 19:35:15
阅读次数:
64
传送门:https://leetcode.com/problems/longest-valid-parentheses/ 题意:给出一个由括号'('与')'组成的字符串,找出最长合法连续子串的长度 思路:首先需要注意的是,子串要是连续的,然后按顺序一个'('匹配一个')',比如"()()()","( ...
分类:
其他好文 时间:
2019-11-30 23:59:23
阅读次数:
127
经典的动态规划题目:最长公共子序列(Longest Common Subsequence),使用二维数组记录,双层循环。 ...
分类:
其他好文 时间:
2019-11-23 23:43:06
阅读次数:
115
solve函数常用于求解符号函数的解析解,方程组的解等 1.solve求解析解 syms x yq='x+y=3';w=solve(q,'x');% 解函数q关于x的解析解 同样可以写成 solve('x+y=3','x');但是这样的话就没法给y赋值了,所以使用 subs函数 y=3; subs( ...
分类:
其他好文 时间:
2019-11-22 19:27:37
阅读次数:
128
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