Description Description Given a string, find length of the longest repeating subsequence such that the two subsequence don’t have same string characte ...
分类:
其他好文 时间:
2019-12-21 22:26:52
阅读次数:
71
public class Solution { public int lengthOfLongestSubstring(String s) { int n = s.length(); int ans = 0; for (int i = 0; i < n; i++) for (int j = i + ...
分类:
其他好文 时间:
2019-12-19 16:17:32
阅读次数:
279
Question: Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, r ...
分类:
其他好文 时间:
2019-12-18 22:08:32
阅读次数:
89
好多天没有更新了,今天有空,刷一道。 算法第5题 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 示例 1: 输入: "babad"输出: "bab"注意: "aba" 也是一个有效答案。示例 2: 输入: "cbbd"输出: "bb" 来源:力扣(Leet ...
分类:
其他好文 时间:
2019-12-18 14:57:38
阅读次数:
65
最近刷题进展尚可,但是形式变化了下,因为感觉眼睛会看瞎,所以好多写在纸上。本来想放到文件夹存储起来,但是太容易丢了,明天整理下,赶紧拍上来把 今晚是周末,这一周都在不停的学学学,我想下周怕是不能睡午觉了,中午回去床对我的诱惑太大了,我得想办法,一进门先把被褥收起来,再放个欢快的歌,中午少吃点,加油小 ...
分类:
其他好文 时间:
2019-12-16 09:32:01
阅读次数:
87
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
传送门:https://leetcode.com/problems/longest-valid-parentheses/ 题意:给出一个由括号'('与')'组成的字符串,找出最长合法连续子串的长度 思路:首先需要注意的是,子串要是连续的,然后按顺序一个'('匹配一个')',比如"()()()","( ...
分类:
其他好文 时间:
2019-11-30 23:59:23
阅读次数:
127