Code Signal_练习题_differentSymbolsNaive
Given a string, find the number of different characters in it.
Example
For s = "cabca", the output should bedifferentSymbolsNaive(s) = 3.
There are 3 different characters a, b and c.
我的解答:
def differentSymbolsNaive(s):
return len(set(s))
一模一样
膜拜大佬
Code Signal_练习题_differentSymbolsNaive的更多相关文章
- Code Signal_练习题_digitDegree
Let's define digit degree of some positive integer as the number of times we need to replace this nu ...
- Code Signal_练习题_Knapsack Light
You found two items in a treasure chest! The first item weighs weight1 and is worth value1, and the ...
- Code Signal_练习题_growingPlant
Each day a plant is growing by upSpeed meters. Each night that plant's height decreases by downSpeed ...
- Code Signal_练习题_arrayMaxConsecutiveSum
Given array of integers, find the maximal possible sum of some of its k consecutive elements. Exampl ...
- Code Signal_练习题_firstDigit
Find the leftmost digit that occurs in a given string. Example For inputString = "var_1__Int&qu ...
- Code Signal_练习题_extractEachKth
Given array of integers, remove each kth element from it. Example For inputArray = [1, 2, 3, 4, 5, 6 ...
- Code Signal_练习题_stringsRearrangement
Given an array of equal-length strings, check if it is possible to rearrange the strings in such a w ...
- Code Signal_练习题_absoluteValuesSumMinimization
Given a sorted array of integers a, find an integer x from a such that the value of abs(a[0] - x) + ...
- Code Signal_练习题_depositProfit
You have deposited a specific amount of money into your bank account. Each year your balance increas ...
随机推荐
- sublime text syntaxdef
http://sublimetext.info/docs/en/extensibility/syntaxdefs.html
- Spring MVC前后端数据交互总结
控制器 作为控制器,大体的作用是作为V端的数据接收并且交给M层去处理,然后负责管理V的跳转.SpringMVC的作用不外乎就是如此,主要分为:接收表单或者请求的值,定义过滤器,跳转页面:其实就是ser ...
- nodeJs实现微信小程序的图片上传
今天我来介绍一下nodejs如何实现保存微信小程序传过来的图片及其返回 首先wx.uploadFile绝大部分时候是配合wx.chooseImage一起出现的,毕竟选择好了图片,再统一上传是实现用户图 ...
- python学习笔记14-函数
使用关键字def来创建函数 注意缩进 函数命名规则: 1.必须以下划线或者字母开头 2.区分大小写 3.不能是保留字 调用函数一定记得加括号 def print_info(name,age) pri ...
- 安装rlwrap方便sqlplus使用
rlwrap包 这是一个为方便使用SQL*PLUS的技巧,为了能像在DOS命令窗口中那样运行SQL*Plus,使用向上.向下键来跳回之前已经执行过的SQL语句. 需要在Linux上安装rlwrap包, ...
- 【xsy1130】tree 树形dp+期望dp
题目写得不清不楚的... 题目大意:给你一棵$n$个节点的树,你会随机选择其中一个点作为根,随后随机每个点深度遍历其孩子的顺序. 下面给你一个点集$S$,问你遍历完$S$中所有点的期望时间,点集S中的 ...
- [原创]K8飞刀20160613 Plesk密码 & 注册表16进制转换 & Html实体解密
K8飞刀 by K8拉登哥哥@[K8搞基大队]博客: http://qqhack8.blog.163.com 简介: K8飞刀是一款多功能的安全测试工具. Hacker Swiss Army Kni ...
- 理解WSGI
WSGI是什么? WSGI,全称 Web Server Gateway Interface,或者 Python Web Server Gateway Interface ,是为 Python 语言定义 ...
- Nginx配置SSL自签名证书
生成自签名SSL证书 生成RSA密钥(过程需要设置一个密码,记住这个密码) $ openssl genrsa -des3 -out domain.key 1024 拷贝一个不需要输入密码的密钥文件 $ ...
- i=i+1,i+=1,i++哪个执行效率最高?为什么?
(1)i=i+1最低,它的执行过程如下:读取右i的地址i+1读取左i的地址将右值传给左边的i(编译器并不认为左右i的地址相同)(2)i+=1其次,它的执行过程如下:读取左x的地址i+1将得到的值传给i ...