Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-08-22 23:56:36
阅读次数:
174
Given a string s that consists of only uppercase English letters, you can perform at most k operations on that string. In one operation, you can choos ...
分类:
其他好文 时间:
2019-08-21 13:39:34
阅读次数:
95
我们把数组 A 中符合下列属性的任意连续子数组 B 称为 “山脉”: B.length >= 3 存在 0 < i < B.length - 1 使得 B[0] < B[1] < ... B[i-1] < B[i] > B[i+1] > ... > B[B.length - 1](注意:B 可以是 ...
分类:
编程语言 时间:
2019-08-20 21:50:32
阅读次数:
72
1 //compute orientation of an ordered triplet of points in the plane 2 /* 3 * counterclockwise, clockwise, colinear 4 */ 5 6 #include 7 8 using namesp... ...
分类:
其他好文 时间:
2019-08-17 17:45:33
阅读次数:
60
【题目链接】: https://loj.ac/problem/10056 【题意】 请输出树上两个点的异或路径 的最大值。 【题解】 这个题目,y总说过怎么做之后,简直就是醍醐灌顶了。 我们知道Xor路径,我们从根结点处理所有结点的 到根结点的异或和,我们想要两个点的异或路径。 其实就是利用根结点 ...
分类:
其他好文 时间:
2019-08-17 00:54:32
阅读次数:
70
题目: 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设?s 的最大长度为 1000。 示例 1: 注意: "aba" 也是一个有效答案。 示例 2: 来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/longest palindrom ...
分类:
其他好文 时间:
2019-08-15 18:48:13
阅读次数:
82
LIS模板题(Longest Ordered Subsequence) "poj 2533" 给出一个序列,求出这个序列的最长上升子序列。 序列A的上升子序列B定义如下: B为A的子序列 B为严格递增序列 Input 第一行包含一个整数n,表示给出序列的元素个数。 第二行包含n个整数,代表这个序列。 ...
分类:
其他好文 时间:
2019-08-13 11:52:37
阅读次数:
96
problem:https://leetcode.com/problems/longest-repeating-character-replacement/ 维护一个最多包含k个额外字符的滑动窗口。需要记录当前出现次数最多字符的出现次数来判断窗口是否合法,如果超过了,就把首指针向后挪一位,同时更新最 ...
分类:
其他好文 时间:
2019-08-11 23:22:33
阅读次数:
113
一: 关键字:trait。 使用方式:通过extends和with方式的混入特质。 使用场景:当我们不想扩展其它的类的时候必须使用entends,当我们需要扩展其它类的时候,就必须使用with,可以混入多个特质,连续使用with即可。 Ordered特质:主要用于对象之间的比较,和Java的Comp ...
分类:
其他好文 时间:
2019-08-11 23:10:12
阅读次数:
93
Leetcode之深度优先搜索(DFS)专题-329. 矩阵中的最长递增路径(Longest Increasing Path in a Matrix) 深度优先搜索的解题详细介绍,点击 给定一个整数矩阵,找出最长递增路径的长度。 对于每个单元格,你可以往上,下,左,右四个方向移动。 你不能在对角线方 ...
分类:
其他好文 时间:
2019-08-11 17:42:37
阅读次数:
152