当前位置:网站首页>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;
}
}
边栏推荐
- 应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
- bizchart+slider实现分组柱状图
- flink1.13 sql基础语法(一)DDL、DML
- 一文掌握数仓中auto analyze的使用
- For MySQL= No data equal to null can be found. Solution
- Exclusive interview of open source summer | new committer Xie Qijun of Apache iotdb community
- 如何使用ConcurrentLinkedQueue做一个缓存队列
- Kubedm initialization error: [error cri]: container runtime is not running
- GTEST from ignorance to proficiency (4) how to write unit tests with GTEST
- Golang面试整理 三 简历如何书写
猜你喜欢
随机推荐
PostgreSQL基本结构——表
Super detailed tutorial, an introduction to istio Architecture Principle and practical application
MongoDB中的索引操作总结
面试官:说说XSS攻击是什么?
Jerry's ad series MIDI function description [chapter]
服装企业为什么要谈信息化?
【活动早知道】LiveVideoStack近期活动一览
[C language] deep understanding of symbols
For MySQL= No data equal to null can be found. Solution
股票开户流程是什么?使用同花顺手机炒股软件安全吗?
机器学习笔记 - 互信息Mutual Information
如何使用ConcurrentLinkedQueue做一个缓存队列
Open3d surface normal vector calculation
时空预测3-graph transformer
如何借助自动化工具落地DevOps
【C语言进阶篇】数组&&指针&&数组笔试题
广电五舟与华为签署合作协议,共同推进昇腾AI产业持续发展
Why do you have to be familiar with industry and enterprise business when doing Bi development?
QT - double buffer plot
Compréhension approfondie du symbole [langue C]





![Compréhension approfondie du symbole [langue C]](/img/4b/26cf10baa29eeff08101dcbbb673a2.png)


