题目: You've got a string a1,a2,…,ana1,a2,…,an, consisting of zeros and ones. Let's call a sequence of consecutive elements ai,ai?+?1,…,?ajai,ai?+?1,…,? ...
分类:
其他好文 时间:
2020-04-11 20:50:12
阅读次数:
58
嘤嘤嘤,因为最近文化课老师追的紧了+班主任开班会,所以这博客是赶制的赝品 题目: You've got a string a1,a2,…,ana1,a2,…,an, consisting of zeros and ones. Let's call a sequence of consecutive ...
分类:
其他好文 时间:
2020-04-11 20:24:04
阅读次数:
91
CanChen ggchen@mail.ustc.edu.cn Max Consecutive Ones II Given a binary array, find the maximum number of consecutive 1s in this array if you can flip ...
分类:
其他好文 时间:
2020-04-10 00:08:30
阅读次数:
81
解法一:水平扫描 int indexOf(String str): 在字符串中检索str,返回其第一出现的位置,如果找不到则返回-1 class Solution { public String longestCommonPrefix(String[] strs) { if(strs.length ...
分类:
编程语言 时间:
2020-04-09 00:43:26
阅读次数:
70
地址:https://leetcode-cn.com/problems/longest-common-prefix/ <?php /** * 编写一个函数来查找字符串数组中的最长公共前缀。 * * 如果不存在公共前缀,返回空字符串 ""。 * * 示例 1: * * 输入: ["flower","f ...
分类:
其他好文 时间:
2020-04-07 22:23:03
阅读次数:
85
替换后的最长重复字符。题意是给一个字符串,只有大写字母,允许你替换其中的K个字母,问替换操作完成后能返回的最长字母相同的子串的长度是多少。例子, Example 1: Input: s = "ABAB", k = 2 Output: 4 Explanation: Replace the two 'A ...
分类:
其他好文 时间:
2020-04-04 09:41:15
阅读次数:
68
要求 在一个字符串中寻找没有重复字母的最长子串 思路 滑动窗口 如果当前窗口没有重复字母,j右移,直到包含重复字母 i右移,直到不包含重复字母 用数组记录字母是否出现过,判断重复 实现 1 class Solution{ 2 public: 3 int lenthOfLongestSubstring ...
分类:
其他好文 时间:
2020-03-30 09:33:07
阅读次数:
64
codeforces-977F-Consecutive Subsequence 传送门:codeforces-977F-Consecutive Subsequence 求最长连续上升子序列,输出序列各元素的位置 刚开始没看懂是要连续,果断打了个LIS,wa了,然后又在上面做了改动,还是不对,老老实实 ...
分类:
其他好文 时间:
2020-03-25 21:49:12
阅读次数:
73
3 Longest Substring Without Repeating Characters 问题描述 Given a string, find the length of the longest substring without repeating characters. Example 1 ...
分类:
其他好文 时间:
2020-03-22 19:48:22
阅读次数:
54
LeetCode 0409. Longest Palindrome最长回文串【Easy】【Python】【字符串】 Problem "LeetCode" Given a string which consists of lowercase or uppercase letters, find the ...
分类:
编程语言 时间:
2020-03-19 21:26:18
阅读次数:
69