找出字符串中第一个只出现一次的字符
题目描述
找出字符串中第一个只出现一次的字符。输入一个非空字符串,输出第一个只出现一次的字符,如果不存在输出-1
示例1:
输入asdfasdfo
输出
o
思路:
利用桶排序的思想
题目描述
找出字符串中第一个只出现一次的字符。输入一个非空字符串,输出第一个只出现一次的字符,如果不存在输出-1
示例1:
输入asdfasdfo
输出
o
思路:
利用桶排序的思想
编写一个Java程序来查找一个字符串中第一个非重复的字符,这是在编程测试中很常见的一个问题,因为字符串处理在程序员面试中是一个普遍的话题。面试前最好是准备好一些熟知的编程问题,例如使用递归反转字符串,或者检查一个字符串是否是回文(即正反读顺序一致)。查找第一个非重复字符的问题也是在同一个范畴。在给出解决方案之前,我们先来弄懂这个问题。我们需要编写一个函数,这个函数接受一个字符串作为参数,并返回第一
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M