当前位置:网站首页>不会就坚持61天吧 最短的单词编码
不会就坚持61天吧 最短的单词编码
2022-07-29 04:13:00 【一只小小明】

class Solution {
public int minimumLengthEncoding(String[] words) {
Set<String> good = new HashSet<String>(Arrays.asList(words));
for (String word: words) {
for (int k = 1; k < word.length(); ++k) {
good.remove(word.substring(k));
}
}
int ans = 0;
for (String word: good) {
ans += word.length() + 1;
}
return ans;
}
}边栏推荐
- Lua language (stm32+2g/4g module) and C language (stm32+esp8266) methods of extracting relevant data from strings - collation
- C language: getchar () and cache
- 开课!看smardaten如何分解复杂业务场景
- Solution: module 'xlrd' has no attribute 'open_ Error reporting of workbook '
- STM32F103ZET6程序移植为C8T6+C8T6下载程序flash timeout的解决方案
- 索引的最左前缀原理
- 有一种密码学专用语言叫做ASN.1
- 安装postgis时报找不到“POSTGIS_VERSION”这个函数
- VScode连接ssh遇到的问题
- C语言:枚举知识点总结
猜你喜欢

Data mining -- code implementation of association analysis example (Part 2)

为什么opengauss启动的时候这么多的unknown?

First knowledge of C language (3)

不会就坚持60天吧 神奇的字典

C language to achieve three chess game (detailed explanation)

LDP -- label distribution protocol

Note: restframe work records many to one tables, how to serialize in that table (reverse query)

Beginner: array & String

通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值

Locally call tensorboard and Jupiter notebook on the server (using mobaxterm)
随机推荐
不会就坚持63天吧 最大的异或
“蔚来杯“2022牛客暑期多校训练营1 J Serval and Essay(启发式合并)
"Weilai Cup" 2022 Niuke summer multi school training camp 2H
Shielding ODBC load balancing mode in gbase 8A special scenarios?
不会就坚持69天吧 合并区间
C declaration and initialization and assignment
C语言:联合体知识点总结
The function "postgis_version" cannot be found when installing PostGIS
Object array merges elements according to a field
Svg -- loading animation
Some problems about pointers
VScode连接ssh遇到的问题
不会就坚持65天吧 只出现一次的数字
HCIP BGP
openFeign异步调用问题
Wechat applet parameter transfer
Beginner: array & String
flink-sql 如何设置 sql执行超时时间
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0x90 in position 614: ordinal not in range(128)
SQL server当存储过程接收的参数是int类型时,如何做判断?