摘要:
描述 大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0,第1项是1)。 n≤39 示例1 输入: 4 返回值: 3 class Solution: def Fibonacci(self, n): a = [0,1] for i in range(2, 阅读全文
摘要:
A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representa 阅读全文
摘要:
请实现一个函数,将一个字符串中的每个空格替换成“%20”。 例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 需要注意的是 有可能是 “ We Are Happy” 或 “We Are Happy ” 或者 “We Are Happy” 所有的空格 阅读全文