Code Signal_练习题_differentSymbolsNaive

Posted yd2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Code Signal_练习题_differentSymbolsNaive相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

Code Signal_练习题_Minesweeper

Code Signal_练习题_stringsRearrangement

Code Signal_练习题_firstDigit

Code Signal_练习题_digitDegree

Code Signal_练习题_matrixElementsSum

Code Signal_练习题_alphabeticShift