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.

思路:找出第一个只出现一次的字母。利用字符索引,先遍历一遍数组统计,然后再遍历一次找出第一个索引值为1 的索引便是。

18. leetcode 387. First Unique Character in a String的更多相关文章

  1. LeetCode 387. First Unique Character in a String (字符串中的第一个唯一字符)

    题目标签:String, HashMap 题目给了我们一个 string,让我们找出 第一个 唯一的 char. 设立一个 hashmap,把 char 当作 key,char 的index 当作va ...

  2. LeetCode 387. First Unique Character in a String

    Problem: Given a string, find the first non-repeating character in it and return it's index. If it d ...

  3. [leetcode]387. First Unique Character in a String第一个不重复字母

    Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...

  4. Java [Leetcode 387]First Unique Character in a String

    题目描述: Given a string, find the first non-repeating character in it and return it's index. If it does ...

  5. [LeetCode] 387. First Unique Character in a String 字符串的第一个唯一字符

    Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...

  6. leetcode修炼之路——387. First Unique Character in a String

    最近公司搬家了,有两天没写了,今天闲下来了,继续开始算法之路. leetcode的题目如下: Given a string, find the first non-repeating characte ...

  7. [LeetCode&Python] Problem 387. First Unique Character in a String

    Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...

  8. *387. First Unique Character in a String (linkedhashmap + string) debug manunally instead of using leetcode

    The ability to debug and overall thinking need to improve Given a string, find the first non-repeati ...

  9. 【LeetCode】387. First Unique Character in a String

    Difficulty:easy  More:[目录]LeetCode Java实现 Description https://leetcode.com/problems/first-unique-cha ...

随机推荐

  1. C. Karen and Game

    C. Karen and Game time limit per test 2 seconds memory limit per test 512 megabytes input standard i ...

  2. CoolBlog开发笔记第2课:搭建开发环境

    教程目录 1.1 CoolBlog开发笔记第1课:项目分析 前言 今天是CoolBlog开发笔记的第2课,我们将要讲解的是开发环境的搭建.俗话说"工欲善其事必先利其器",Djang ...

  3. Redis中的数据对象

    redis对象 redis中有五种常用对象 我们所说的对象的类型大多是值的类型,键的类型大多是字符串对象,值得类型大概有以下几种,但是无论哪种都是基于redisObject实现的 redisObjec ...

  4. 15套java架构师大型分布式综合项目实战、千万高并发-视频教程

    * { font-family: "Microsoft YaHei" !important } h1 { color: #FF0 } 15套java架构师.集群.高可用.高可扩 展 ...

  5. Linux下php安装memcache

    Linux下php安装memcache说明:php安装目录:/phpstudy/server/php/bin/phpphp.ini配置文件路径:/phpstudy/server/php/etc/php ...

  6. JAVAEE学习笔记

    以后创建常量有三个名字:Constant   SystemParas   StaticValue 上限或者下限命名      max_    min_ 包含的范围命名     first      l ...

  7. 【Android Developers Training】 78. 序言:执行网络操作

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  8. container_of 的用法

    1.问题:如何通过结构中的某个变量获取结构本身的指针???关于container_of见kernel.h中:/*** container_of - cast a member of a structu ...

  9. crm管理系统

    开始的时候,我们小组开始先完成各自的静态页面,并实现页面的跳转. //部门主页面 //部门添加页面 //部门修改页面 并通过AJXA发送到后台,后台通过处理方法,并返回到前端. 需要注意的是:在下拉列 ...

  10. Oracle的用户、角色以及权限相关操作

    1.创建用户create user KD identified by 123456;2.授予连接数据库的权限grant connect to KD;3.将Scott用户的emp表授权给KD可以查询gr ...