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 bedifferentSymbolsNaive(s) = 3
.
There are 3
different characters a
, b
and c
.
我的解答:
def differentSymbolsNaive(s): return len(set(s))
一模一样
以上是关于Code Signal_练习题_differentSymbolsNaive的主要内容,如果未能解决你的问题,请参考以下文章
Code Signal_练习题_stringsRearrangement