代码: #include<iostream> #include<stdio.h> using namespace std; const int maxn = 1001; int a[maxn],dp[maxn]; int main(){ int n; cin>>n; for(int i=1;i<=n ...
分类:
其他好文 时间:
2020-02-26 18:32:51
阅读次数:
54
D. Shortest and Longest LIS "原题" Problem Restatement 给出一个序列相邻的大小关系,构造相应长度满足大小关系的 排列 ,使得最长上升子序列最短或最长。 Solution 考虑到给出的是相邻的递增递减,我们会发现序列是由一段上坡一段下坡类似组合而成。而 ...
分类:
其他好文 时间:
2020-02-25 12:44:37
阅读次数:
65
B. Longest Palindrome "原题" Problem Restatement 给出n个,长度为m的字符串。$(1≤??≤100,1≤m≤50) $ 用部分或全部字符串,在一定的顺序拼接下,拼出最长的回文串。 Solution 数据小,暴力贪心即可。 对于每个串寻找是否存在其共轭串(即 ...
分类:
其他好文 时间:
2020-02-25 09:52:21
阅读次数:
57
题目: Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the ...
分类:
编程语言 时间:
2020-02-23 19:56:52
阅读次数:
92
无重复字符的最长子串 题目链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: "abcabcbb" ...
分类:
其他好文 时间:
2020-02-23 09:52:15
阅读次数:
59
Given a string, find the longest substring without any repeating characters and return the length of it. The input string is guaranteed to be not null ...
分类:
其他好文 时间:
2020-02-20 22:14:59
阅读次数:
62
2020-02-20 16:34:16 问题描述: 问题求解: public int[] numMovesStonesII(int[] stones) { int n = stones.length; Arrays.sort(stones); int min = n; int start = 0; ...
分类:
其他好文 时间:
2020-02-20 17:09:55
阅读次数:
121
1 """ 2 Given a string, find the length of the longest substring without repeating characters. 3 Example 1: 4 Input: "abcabcbb" 5 Output: 3 6 Explanat ...
分类:
其他好文 时间:
2020-02-19 21:02:41
阅读次数:
53
题目内容 Example: 分析过程 题目归类: 垂直比较 题目分析: 最简单的思路就是从头开始,第一轮比较第一个字符,第二轮比较第二个字符·····这样的效率比较低。 新的方法是,(接下来的数组代表字符串,0代表strs[0])0和1比较后存到0,然后0和2比较后保存到0····· 利用Strin ...
分类:
其他好文 时间:
2020-02-17 16:13:55
阅读次数:
51
看样例, 的堪称一段,比如样例就是 每段内必须下降,考虑让它连续,然后让段膜取当前没去过的最小值即可 ...
分类:
其他好文 时间:
2020-02-17 16:04:58
阅读次数:
64