LeetCode-First Unique Character in a String
来源:互联网 发布:太原网络规划研究院 编辑:程序博客网 时间:2024/04/28 22:34
题目:
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.
Examples:
s = "leetcode"return 0.s = "loveleetcode",return 2.
Note: You may assume the string contain only lowercase letters.
题目意思时给你一个字符串,找出第一个没有在字符串重复出现的的字符的下标索引号;解题思路:先用hashmap把字符串中每一个字符存储到hashmap中,把字符串重复数存储到key所对应的value中,然后再遍历hashmap,找第一个value等于1的数值对,返回其下标索引即可;
代码如下:
0 0
- [Leetcode]First Unique Character in a String
- LeetCode: First Unique Character in a String
- LeetCode-First Unique Character in a String
- leetcode---First Unique Character in a String
- leetcode:First Unique Character in a String
- LeetCode-First Unique Character in a String
- [Leetcode] First Unique Character in a String
- leetcode First Unique Character in a String
- Leetcode First Unique Character in a String
- LEETCODE--First Unique Character in a String
- LeetCode -- First Unique Character in a String
- LeetCode : First Unique Character in a String
- LeetCode First Unique Character in a String
- LeetCode-----First Unique Character in a String
- LeetCode—387. First Unique Character in a String
- 【leetcode】387. First Unique Character in a String【E】
- LeetCode(387)First Unique Character in a String
- <LeetCode OJ> 387. First Unique Character in a String
- 跳台阶——斐波那契数列问题
- 今天粗心的一些心得
- Windows窗体应用程序
- android studio中OkHttp请求数据
- Bluemix平台打造DC/OS云计算平台(一)
- LeetCode-First Unique Character in a String
- 适配器的用法
- LTE网络主要包含的接口信息
- Fragment创建及其生命周期
- 不需要去了。。。。
- 【例题】【并查集(带权)&题干有诈】NKOJ 3764 树上间距
- PANDAS 数据合并与重塑(concat篇)
- Linux文件系统的实现
- 一个编程题的思考