困难题,先想着DP扫描,但是会爆栈; 主体思想仍然采用滑动窗口来进行; 但是对于该题目,有一个比较新的点,要利用脑经急转弯思想把问题转换一下; 对于正好为K个不同元素组成的最长字符串可以转换为: 最多由K个不同元素组成的字符串-最多由K-1个不同元素组成的字符串; (这样可以有效的降低复杂度,使得单 ...
分类:
编程语言 时间:
2021-02-10 13:13:44
阅读次数:
0
剑指 Offer 53 - II. 0~n-1中缺失的数字 Offer_53 题目详情 java代码 package com.walegarrett.offer; /** * @Author WaleGarrett * @Date 2021/2/9 20:33 */ /** * 题目详情:一个长度为 ...
分类:
其他好文 时间:
2021-02-10 13:12:51
阅读次数:
0
Given the root of a binary tree, return the leftmost value in the last row of the tree. Example 1: Input: root = [2,1,3] Output: 1 Example 2: Input: r ...
分类:
其他好文 时间:
2021-02-10 12:54:11
阅读次数:
0
992. K 个不同整数的子数组 给定一个正整数数组 A,如果 A 的某个子数组中不同整数的个数恰好为 K,则称 A 的这个连续、不一定独立的子数组为好子数组。 (例如,[1,2,3,1,2] 中有 3 个不同的整数:1,2,以及 3。) 返回 A 中好子数组的数目。 示例 1: 输入:A = [1 ...
分类:
编程语言 时间:
2021-02-10 12:52:11
阅读次数:
0
原题 1 class Solution: 2 def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: 3 dic1,dic2 = {},{} 4 def helper(nums,dic): 5 for n in nu ...
分类:
编程语言 时间:
2021-02-10 12:50:25
阅读次数:
0
此博客链接:https://www.cnblogs.com/ping2yingshi/p/14391627.html 整数拆分 题目链接:https://leetcode-cn.com/problems/integer-break/ 题目 给定一个正整数 n,将其拆分为至少两个正整数的和,并使这些整 ...
分类:
其他好文 时间:
2021-02-09 12:30:48
阅读次数:
0
Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any position ...
分类:
其他好文 时间:
2021-02-09 12:12:28
阅读次数:
0
https://leetcode-cn.com/problems/er-cha-shu-de-jing-xiang-lcof/ 请完成一个函数,输入一个二叉树,该函数输出它的镜像。 例如输入: 4 / \ 2 7 / \ / \1 3 6 9镜像输出: 4 / \ 7 2 / \ / \9 6 3 ...
分类:
其他好文 时间:
2021-02-09 11:56:17
阅读次数:
0
题目描述: 在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个高效的函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 示例: 现有矩阵 matrix 如下: [ [1, 4, 7, 11, 15], [2, 5, 8 ...
分类:
编程语言 时间:
2021-02-09 11:47:39
阅读次数:
0
此博客链接: 旋转图像 题目链接:https://leetcode-cn.com/problems/rotate-image/ 题目 给定一个 n × n 的二维矩阵 matrix 表示一个图像。请你将图像顺时针旋转 90 度。 你必须在 原地 旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要 ...
分类:
其他好文 时间:
2021-02-09 11:47:06
阅读次数:
0