当前位置:网站首页>[sword finger offer] interview question 50: the first character that appears only once - hash table lookup
[sword finger offer] interview question 50: the first character that appears only once - hash table lookup
2022-07-27 15:52:00 【Jocelin47】

class Solution {
public:
char firstUniqChar(string s) {
//unordered_map<char, int> freq;
int freq[256]= {
0};
for(char ele: s)
freq[ele]++;
for(char ele: s)
if(freq[ele]== 1)
return ele;
return ' ';
}
};
边栏推荐
- Fluent -- layout principle and constraints
- 直接插入排序
- 【剑指offer】面试题50:第一个只出现一次的字符——哈希表查找
- 数据表的约束以及设计、联合查询——8千字攻略+题目练习解答
- 【剑指offer】面试题54:二叉搜索树的第k大节点
- [regular expression] single character matching
- Summer Challenge harmonyos realizes a hand-painted board
- [正则表达式] 匹配分组
- Stock account opening commission discount, stock trading account opening which securities company is good, is online account opening safe
- Zhaoqi scientific innovation and entrepreneurship competition planning and undertaking organization, mass entrepreneurship and innovation platform, project landing and docking
猜你喜欢
随机推荐
C language: custom type
$router.back(-1)
折半插入排序
Spark 3.0 testing and use
实体类(VO,DO,DTO)的划分
Summer Challenge harmonyos realizes a hand-painted board
线程间等待与唤醒机制、单例模式、阻塞队列、定时器
On juicefs
【剑指offer】面试题50:第一个只出现一次的字符——哈希表查找
【剑指offer】面试题53-Ⅰ:在排序数组中查找数字1 —— 二分查找的三个模版
【剑指offer】面试题56-Ⅰ:数组中数字出现的次数Ⅰ
折半查找
IP protocol of network layer
网络设备硬核技术内幕 路由器篇 22
The risk of multithreading -- thread safety
C: What is the return value (revolution) in a function
[regular expression] match the beginning and end
数据表的约束以及设计、联合查询——8千字攻略+题目练习解答
表格插入行内公式后,单元格失去焦点
Spark RPC

![[tensorboard] oserror: [errno 22] invalid argument processing](/img/bf/c995f487607e3b307a268779ec1e94.png)






