当前位置:网站首页>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;
}
}
边栏推荐
- 面试官:说说XSS攻击是什么?
- 赋能数字经济 福昕软件出席金砖国家可持续发展高层论坛
- VS2019 C# release下断点调试
- CloudCompare&Open3D DBSCAN聚类(非插件式)
- Basic structure of PostgreSQL - table
- 智洋创新与华为签署合作协议,共同推进昇腾AI产业持续发展
- HDU - 1078 fatmouse and cheese (memory search DP)
- Master the use of auto analyze in data warehouse
- 可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
- Bizchart+slider to realize grouping histogram
猜你喜欢
TCP三次握手,四次挥手,你真的了解吗?
Bizchart+slider to realize grouping histogram
[leetcode] 17. Letter combination of telephone number
VS2019 C# release下断点调试
NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
Bookmark
CloudCompare&Open3D DBSCAN聚类(非插件式)
什么是商业智能(BI),就看这篇文章足够了
GTEST from ignorance to proficiency (3) what are test suite and test case
【C語言】符號的深度理解
随机推荐
Basic structure of PostgreSQL - table
El tree combined with El table, tree adding and modifying operations
QT—双缓冲绘图
File read write
如何借助自动化工具落地DevOps
NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
【LeetCode】17、电话号码的字母组合
挖财学院股票开户安全吗?开户只能在挖财开户嘛?
Relational database
Learning breakout 3 - about energy
Open3d surface normal vector calculation
Delphi soap WebService server-side multiple soapdatamodules implement the same interface method, interface inheritance
Is it safe to open an account in the stock of Caicai college? Can you only open an account by digging money?
【活动早知道】LiveVideoStack近期活动一览
面试题 01.08. 零矩阵
283. 移动零-c与语言辅助数组法
KDD2022 | 什么特征进行交互才是有效的?
AcWing 2022 每日一题
Spatiotemporal prediction 3-graph transformer
什么是商业智能(BI),就看这篇文章足够了