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 ...
随机推荐
- python中a,b=b,a原理
python中 a , b = b , a 可以将 a 和 b 的值交换 >>> a = 1 >>> b = 2 >>> a , b = ...
- python中的三次握手以及四次挥手
三次握手1.客户端对服务端说:我的序号是x,我要向你请求连接:(第一次握手,发送SYN包,然后进入SYN-SEND状态)2.服务端听到之后对客户端说:我的序号是y,期待你下一句序号是x+1的话(意思就 ...
- Redis---ZipList(压缩列表)
1.概述 压缩列表是一块连续的内存空间,元素之间紧挨着存储,没有任何冗余空间. Redis 为了节约内存空间使用,zset 和 hash 容器对象在元素个数较少的时候,采用压缩列表 (ziplist) ...
- HTTP的请求报文与响应报文
报文: 简单来说,报文就是也就是HTTP报文,作用是在各个系统之间进行和响应时用来交换与传输的数据单元,即站点一次性要发送的数据块,这些数据块以一些文本形式的元信息开头,这些信息描述了报文的内容及含义 ...
- postgresql-定时备份,压缩备份
crontab -e 在最后添加: # backup database at 22:00 every day 0 22 * * * thunisoft /home/eric/bin/backup-db ...
- Vue, React, AngularJS, and Angular2. 我们对流行JavaScript框架们的选择
2017-08-04 前端大全 (点击上方公众号,可快速关注) 英文:ANTONI ZOLCIAK 译文:众成翻译 www.zcfy.cc/article/vue-react-angularjs-a ...
- vue教程3-03 vue组件,定义全局、局部组件,配合模板,动态组件
vue教程3-03 vue组件,定义全局.局部组件,配合模板,动态组件 一.定义一个组件 定义一个组件: 1. 全局组件 var Aaa=Vue.extend({ template:'<h3&g ...
- odoo开发笔记:Server+Action服务器动作自动触发执行
Odoo的市场定位是SME(中小型企业),这个市场的ERP产品,多如牛毛,产品各具特色.不过,Odoo的自动化处理机制,可以睥睨天下,无人能及.包括一些大型国产软件,如用友.金蝶也不具备 ...
- 前端基础——css
前端基础——css css的内容主要包括:盒子模型.定位.单位与取值.属性.选择器.
- Entity Framework 6.x 学习之Database First
一.单表操作 1. 建表 CREATE TABLE [Chapter1].[Customer] ( , ), ) COLLATE Chinese_PRC_CI_AS NOT NULL, ) COLLA ...