python leetcode 387. First Unique Character in a String
利用find函数能极大地减少运行时间
class Solution:def firstUniqChar(self, s):""":type s: str:rtype: int"""c='qwertyuiopasdfghjklzxcvbnm'res=2**31-1for n in c:index = s.find(n)if index ==-1:continueif s[index+1:].find(n)==-1:res=min(res,index)return res if res!=2**31-1 else -1
python leetcode 387. First Unique Character in a String相关推荐
- LeetCode: 387. First Unique Character in a String
051105 题目 Given a string, find the first non-repeating character in it and return it's index. If it ...
- [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 ...
- 387. 字符串中的第一个唯一字符(javascript)387. First Unique Character in a String
leetcode:https://leetcode-cn.com/problems/first-unique-character-in-a-string/ 387. 字符串中的第一个唯一字符 给定一个 ...
- 387. First Unique Character in a String QuestionEditorial Solution
Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...
- LeetCode之First Unique Character in a String
1.题目 Given a string, find the first non-repeating character in it and return it's index. If it doesn ...
- 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 ...
- leetcode 387. 字符串中的第一个唯一字符(First Unique Character in a String)
目录 题目描述: 示例: 解法: 题目描述: 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引.如果不存在,则返回 -1. 示例: s = "leetcode"返回 0. ...
- C#LeetCode刷题之#387-字符串中的第一个唯一字符(First Unique Character in a String)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3939 访问. 给定一个字符串,找到它的第一个不重复的字符,并返回 ...
- 【LeetCode】467. Unique Substrings in Wraparound String 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址: https://leetcode.com/problems/unique-s ...
最新文章
- 动态规划走楼梯_动态规划问题为什么要画表格?
- js中字符串转为对象或者json
- [bzoj1187][HNOI2007]神奇游乐园
- php配置cors跨域漏洞怎么修复,CORS跨域漏洞的简单认识
- php和js序列化,PHP中serialize和json序列化与反序列化的区别
- pyspark对应的scala代码PythonRDD类
- [二进制拆分]Luogu1833 樱花
- macbook Intel版本安装anaconda和配置镜像源
- 搜狗输入法linux设置快捷键设置,搜狗输入法怎么创建桌面快捷键方式?
- 什么是知识库,怎么制作知识库?
- 域名申请攻略(以godaddy+支付宝为例)
- java timeunit_java并发之TimeUnit
- HTML5网页文本内容
- win10计算机无法识别u盘,win10电脑无法识别U盘应该如何解决
- 二进制文件漏洞挖掘 IDA插件VulFi安装使用
- iOS企业版app部署到自己的服务器
- 【windows】设置远程桌面连接?多用户登录设置?取消登录密码
- 电脑监控软件可以监控到企业微信吗?
- 大一C语言图形界面点餐系统
- android 4.0 更换鼠标图案