【Codeforces1234D】Distinct Characters Queries 的题解 ...
分类:
其他好文 时间:
2020-03-18 23:28:27
阅读次数:
44
题目: 思路: 思路很简单,只要分别统计chars中和每个单词中字母出现的个数,chars中的字母大于等于每个单词中的字母的个数,这个单词便是good 可以利用C++中的map实现,现在记录一种更灵活更常用的方式,凡是要统计字母个数,都可以这样处理: 创建一个数组vec[26],每个位置分别存储的是 ...
分类:
其他好文 时间:
2020-03-17 22:36:19
阅读次数:
75
(第一篇博客,希望大家多多支持!还是初学者,若有问题或更好的见解请在评论区指出,欢迎交流!) 一、问题描述 Write an encryption program that reads from cin (a file)and writes the encoded characters to cou ...
分类:
编程语言 时间:
2020-03-16 23:12:59
阅读次数:
77
There is a frog staying to the left of the string s=s1s2…sns=s1s2…sn consisting of nn characters (to be more precise, the frog initially stays at the ...
分类:
其他好文 时间:
2020-03-14 23:29:12
阅读次数:
56
一、背景说明 最开始不愿意使用Python,一大原因是因为Python2默认使用ASCII编码处理中文可以说是一件痛苦的事情。仅从更换默认编码一项变换,就可以说Python3和Python2不算同一门语言。 Python3更换为默认使用Unicode(utf-8)编码,一直使用下来再没有遇到编码问题 ...
分类:
编程语言 时间:
2020-03-13 20:54:58
阅读次数:
64
class Solution { public int lengthOfLongestSubstring(String s) { int[] dict = new int[256]; Arrays.fill(dict, -1); int maxLen = 0, start = -1; for (in ...
分类:
编程语言 时间:
2020-03-12 14:37:50
阅读次数:
71
LeetCode 1374. Generate a String With Characters That Have Odd Counts生成每种字符都是奇数个的字符串【Easy】【Python】【字符串】 Problem "LeetCode" Given an integer , return a ...
分类:
编程语言 时间:
2020-03-08 15:46:37
阅读次数:
82
"题目" DP 险过。 dp[i][j] :means it need remove at least dp[i][j] characters to get vaild parenthese from position i to postion j in string. vector str[i][ ...
分类:
其他好文 时间:
2020-03-07 12:52:52
阅读次数:
52
``` class Solution: def lengthOfLongestSubstring(self, s: str) -> int: # outlier if s == "": return 0 if len(s) == 1: return 1 max_i = 0 start = 0 end... ...
分类:
其他好文 时间:
2020-03-06 20:22:22
阅读次数:
56
最多有K个不同字符的最长子串。题意就不解释了,参见159题。例子, Example 1: Input: s = "eceba", k = 2 Output: 3 Explanation: T is "ece" which its length is 3. Example 2: Input: s = ...
分类:
其他好文 时间:
2020-02-28 15:37:15
阅读次数:
51