当前位置:网站首页>面试题 01.01. 判定字符是否唯一
面试题 01.01. 判定字符是否唯一
2022-07-04 21:23:00 【Mr Gao】
面试题 01.01. 判定字符是否唯一
实现一个算法,确定一个字符串 s 的所有字符是否全都不同。
示例 1:
输入: s = “leetcode”
输出: false
示例 2:
输入: s = “abc”
输出: true
这题其实比较简单的,解题代码如下:
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;
}
}
边栏推荐
- Bookmark
- 股票开户佣金最低多少,炒股开户佣金最低网上开户安全吗
- WGCNA analysis basic tutorial summary
- Enlightenment of maker thinking in Higher Education
- Compréhension approfondie du symbole [langue C]
- Flutter TextField示例
- Numpy vstack and column_ stack
- [C language] deep understanding of symbols
- redis03——Redis的网络配置与心跳机制
- Case sharing | integrated construction of data operation and maintenance in the financial industry
猜你喜欢

gtest从一无所知到熟练使用(3)什么是test suite和test case
![Jerry's ad series MIDI function description [chapter]](/img/d7/348d85eb9f69ffd75612eeba56b16e.png)
Jerry's ad series MIDI function description [chapter]

ArcGIS 10.2.2 | solution to the failure of ArcGIS license server to start

一文掌握数仓中auto analyze的使用

巅峰不止,继续奋斗!城链科技数字峰会于重庆隆重举行

redis03——Redis的网络配置与心跳机制

What is business intelligence (BI), just look at this article is enough

SolidWorks工程图添加材料明细表的操作

什么是商业智能(BI),就看这篇文章足够了

GTEST from ignorance to proficiency (3) what are test suite and test case
随机推荐
Master the use of auto analyze in data warehouse
Jerry's ad series MIDI function description [chapter]
At the right time, the Guangzhou station of the city chain science and Technology Strategy Summit was successfully held
VS2019 C# release下断点调试
Delphi SOAP WebService 服务器端多个 SoapDataModule 实现相同的接口方法,接口继承
bizchart+slider实现分组柱状图
minidom 模块写入和解析 XML
挖财学院股票开户安全吗?开户只能在挖财开户嘛?
改善机器视觉系统的方法
Flutter TextField示例
Analyzing the maker space contained in steam Education
从RepVgg到MobileOne,含mobileone的代码
Super detailed tutorial, an introduction to istio Architecture Principle and practical application
关系型数据库
创客思维在高等教育中的启迪作用
刘锦程荣获2022年度中国电商行业创新人物奖
淘宝商品评价api接口(item_review-获得淘宝商品评论API接口),天猫商品评论API接口
gtest从一无所知到熟练运用(1)gtest安装
Numpy vstack and column_ stack
Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation