找字符串中第一个只出现一次的字符
来源:互联网 发布:unity3d litjson 编辑:程序博客网 时间:2024/05/17 07:44
#include<iostream>#include<stdio.h>char find_fir_repeat_char(const char *str);char find_fir_repeat_char(const char *str){ if(NULL == str) { return '\0'; } const char *p_str =NULL; int count[256] = {0}; for(p_str = str; *p_str != '\0';p_str++) { count[*p_str]++; } p_str = str; while(p_str != '\0'){ if(count[*p_str] == 2) { return *p_str; } p_str++; }} int main(){ char str[] = "liusenin"; char cha = find_fir_repeat_char(str); printf("%c\n",cha); return 0;}
运行结果:
i
Press any key to continue
小结:
哈希表的思想
0 0
- 找字符串中第一个只出现一次的字符
- C++找字符串中第一个只出现一次的的字符下标(牛客剑指offer)
- 在一个字符串中找第一个只出现一次的字符
- 找出字符串中只出现一次的第一个字符
- 查找字符串中第一个只出现一次的字符
- 找出字符串中第一个只出现一次的字符
- 查找字符串中第一个只出现一次的字符
- 字符串中第一个只出现一次的字符
- 字符串中第一个只出现一次的字符
- 查找字符串中第一个只出现一次的字符
- 查找字符串中第一个只出现一次的字符
- 字符串中第一个只出现一次的字符
- 寻找字符串中只出现一次的第一个字符
- 字符串中第一个只出现一次的字符
- 查找字符串中第一个只出现一次的字符
- 找出字符串中第一个只出现一次的字符
- 字符串中第一个只出现一次的字符
- 找出字符串中第一个只出现一次的字符
- Exception异常处理
- Android 事件分发机制(最新源码6.0分析)--childView
- 字串变换
- QT国际化翻译的使用
- Java笔记之socket中的SSL
- 找字符串中第一个只出现一次的字符
- Redhat Enterprise 7.2 安装 MySQL 5.7
- HDU 2897 Bash博弈变形
- SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
- SaaS WMS与传统WMS的区别
- 如何让本机mysql可以远程连接
- _.filter
- 1.OpenGL-搭建windows开发环境
- fft URL