当前位置:网站首页>++cnt1[s1.charAt(i) - ‘a‘];
++cnt1[s1.charAt(i) - ‘a‘];
2022-07-24 06:10:00 【A little cute C】
++cnt1[s1.charAt(i) - 'a']; among String s1
s1.charAt(i) Return string s1 Of the i Characters .
Suppose the string s1 Only lowercase letters ( For instance from 'a' To 'z'),s1.charAt(i) - 'a' The returned character is a Of index 0,b index 1, wait (z index25)
++cnt1[s1.charAt(i) - 'a'];// Match character s1.charAt(i) The corresponding counter plus 1.
therefore , This cycle for (int i = 0; i < n; ++i) {++cnt1[s1.charAt(i) - 'a']; } Compute string s1 The number of times each letter appears in .
Last , One cn1[0] Will include 'a' The number of , One cn1[1] Will include 'b' The number of , And so on .
边栏推荐
- 《剑指Offer》 二维数组的查找 C语言版本
- QT drawing exception using pure code
- Bat batch script, running multiple files at the same time, batch commands executed in sequence, and xshell script.
- Common features of ES6
- [deep learning] handwritten neural network model preservation
- 机器学习&深度学习 入门资料分享总结
- MySQL基础---约束
- Statistical analysis of catering data --- Teddy cloud course homework
- 原生js放大镜效果
- [MYCAT] MYCAT configuration file
猜你喜欢
![[MYCAT] MYCAT sets up read-write separation](/img/7e/bc3488d3ca77104af101d45d723967.png)
[MYCAT] MYCAT sets up read-write separation

Installation of tensorflow and pytorch frames and CUDA pit records

JVM系统学习

JUC并发编程基础(8)--读写锁
![[activiti] process variables](/img/5e/34077833f6eb997e64f186d4773e89.png)
[activiti] process variables

Statistical analysis of catering data --- Teddy cloud course homework

Common features of ES6

day6-jvm
![[MYCAT] MYCAT configuration file](/img/53/63a633d3ae917e3754f9f7f5c6567f.png)
[MYCAT] MYCAT configuration file

Unity基础知识及一些基本API的使用
随机推荐
Hit the wall record (continuously updated)
Foundation of JUC concurrent programming (6) -- lock lock
使用Keras和LSTM实现对于长期趋势记忆的时间序列预测-LSTNet
Qt 使用纯代码画图异常
Foundation of JUC concurrent programming (8) -- read write lock
[MYCAT] related concepts of MYCAT
PDF Text merge
[principles of database system] Chapter 5 algebra and logic query language: package, extension operator, relational logic, relational algebra and datalog
Machine learning (Zhou Zhihua) Chapter 3 Notes on learning linear models
Common methods of array
谷歌/火狐浏览器管理后台新增账号时用户名密码自动填入的问题
day-7 jvm完结
vscode 多行注释总是会自动展开的问题
Common features of ES6
Openwrt quick configuration Samba
day5-jvm
Pytorch single machine multi card distributed training
顺序栈 C语言 进栈 出栈 遍历
MySql下载,及安装环境设置
Opencv reads avi video and reports an error: number < Max_ number in function ‘icvExtractPattern