码迷,mamicode.com
首页 > 其他好文 > 详细

Code Signal_练习题_differentSymbolsNaive

时间:2018-08-16 23:43:04      阅读:438      评论:0      收藏:0      [点我收藏+]

标签:解答   diff   har   nbsp   ring   class   cli   turn   code   

Given a string, find the number of different characters in it.

Example

For s = "cabca", the output should be
differentSymbolsNaive(s) = 3.

There are 3 different characters ab and c.

 

我的解答:

def differentSymbolsNaive(s):
    return len(set(s))

 

 

技术分享图片
一模一样
膜拜大佬

 

Code Signal_练习题_differentSymbolsNaive

标签:解答   diff   har   nbsp   ring   class   cli   turn   code   

原文地址:https://www.cnblogs.com/YD2018/p/9490656.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!