当前位置:网站首页>Interview question 01.01 Determine whether the character is unique
Interview question 01.01 Determine whether the character is unique
2022-07-04 22:02:00 【Mr Gao】
Interview questions 01.01. Determine whether the character is unique
Implement an algorithm , Determine a string s Whether all the characters of are different .
Example 1:
Input : s = “leetcode”
Output : false
Example 2:
Input : s = “abc”
Output : true
This question is actually relatively simple , The solution code is as follows :
bool isUnique(char* astr){
int r[26];
int i;
for(i=0;i<26;i++){
r[i]=0;
}
i=0;
while(astr[i]!='\0'){
r[astr[i]-'a']++;
// printf("%d",)
if(r[astr[i]-'a']>=2){
return false;
}
i++;
}
return true;
}
}
边栏推荐
- Keep on fighting! The city chain technology digital summit was grandly held in Chongqing
- 能源势动:电力行业的碳中和该如何实现?
- Bizchart+slider to realize grouping histogram
- Cadre WebGIS - kalrry
- Flink1.13 SQL basic syntax (I) DDL, DML
- 超详细教程,一文入门Istio架构原理及实战应用
- [public class preview]: basis and practice of video quality evaluation
- GTEST from ignorance to proficiency (4) how to write unit tests with GTEST
- 智洋创新与华为签署合作协议,共同推进昇腾AI产业持续发展
- gtest从一无所知到熟练使用(4)如何用gtest写单元测试
猜你喜欢
[advanced C language] array & pointer & array written test questions
【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】
【C語言】符號的深度理解
TCP协议三次握手过程
bizchart+slider实现分组柱状图
TCP protocol three times handshake process
HUAWEI nova 10系列发布 华为应用市场筑牢应用安全防火墙
KDD2022 | 什么特征进行交互才是有效的?
QT—绘制其他问题
Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation
随机推荐
El tree combined with El table, tree adding and modifying operations
Solve the problem of data disorder caused by slow asynchronous interface
Cadeus has never stopped innovating. Decentralized edge rendering technology makes the metauniverse no longer far away
Spatiotemporal prediction 3-graph transformer
Enlightenment of maker thinking in Higher Education
Lambdaquerywrapper usage
WebGIS框架---kalrry
MongoDB聚合操作总结
GTEST from ignorance to proficient use (2) what is test fixture
HDU - 2859 Phalanx(DP)
Caduceus从未停止创新,去中心化边缘渲染技术让元宇宙不再遥远
广电五舟与华为签署合作协议,共同推进昇腾AI产业持续发展
HDU - 1078 FatMouse and Cheese(记忆化搜索DP)
关系型数据库
Basic structure of PostgreSQL - table
【公开课预告】:视频质量评价基础与实践
迷失在Mysql的锁世界
Golang面试整理 三 简历如何书写
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
How to remove the black dot in front of the title in word document