38. Count and Say

Problem's Link

----------------------------------------------------------------------------

Mean:

题目意思太晦涩。

1 读出来 就是“1个1” 所以记为“11”

11 读出来 就是“2个1” 所以记为“21”

21 读出来 就是“1个2 1个1” 所以记为“1221”

....

analyse:

略.

Time complexity: O(N)

view code

1.recursive way:

)
           ; ;
           )
       )
       );
   ;
}
/*

*/

2.no-recursive way:

)
           ;;
               ;
}
/*

*/

LeetCode - 38. Count and Say的更多相关文章

  1. LeetCode 38 Count and Say(字符串规律输出)

    题目链接:https://leetcode.com/problems/count-and-say/?tab=Description   1—>11—>21—>1211—>111 ...

  2. [LeetCode] 38. Count and Say 计数和读法

    The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 ...

  3. Java [leetcode 38]Count and Say

    题目描述: The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, ...

  4. [leetcode]38. Count and Say数数

    The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 ...

  5. [LeetCode] 38. Count and Say_Easy

    The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 ...

  6. Leetcode 38 Count and Say 传说中的递推

    class Solution { public: vector<string> vs_; Solution(){ "); vs_.push_back(t); ; i< ;+ ...

  7. leetcode 38 Count and Say ---java

    这道题主要就是求一个序列,题目得意思就是 1 --> 11 --> 21 --> 1211 -->   111221 --> 312211 --> ..... 1个 ...

  8. LeetCode - 38. Count and Say(36ms)

    The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 ...

  9. LeetCode题解38.Count and Say

    38. Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11 ...

随机推荐

  1. Scala 深入浅出实战经典 第60讲:Scala中隐式参数实战详解以及在Spark中的应用源码解析

    王家林亲授<DT大数据梦工厂>大数据实战视频 Scala 深入浅出实战经典(1-87讲)完整视频.PPT.代码下载:百度云盘:http://pan.baidu.com/s/1c0noOt6 ...

  2. finished with non-zero exit 添加v7包报错的问题

    错误: 添加 compile 'com.android.support:appcompat-v7:22.2.0'后报错,里面有其它的jar包,但是只要添加这个v7包就报错. Error:Executi ...

  3. Git忽略配置文件gitignore

    在git客户端用户工程根目录下,.git同级目录创建文件.gitignore,文件名为.gitignore.目的是为了忽略一些不需要提交的文件到git服务器 配置如下: bin target .set ...

  4. 【网络编程】——linux socket demo

    #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/socket ...

  5. Android网络访问库 - Retrofit学习(1)基础

    Retrofit是什么 Retrofit是一个类型安全的HTTP客户端,支持Android和Java.它是Square公司开源的项目,当前版本2.0. 在实际开发中,我们Retrofit配合OKHTT ...

  6. 允许CEF跨域访问iframe

    默认情况下,如果嵌入本地Web页面,并在页面内部使用iframe来显示一个在线页面,加载的过程中会触发一个未捕获异常,虚函数CefV8ContextHandler::OnUncaughtExcepti ...

  7. Swift 集合类型

     Swift语言提供数组和字典的集合类型  Swift 语言里的数组和字典中存储的数据值类型必须明确 ,即数组中只能存放同类型的数据. 1: 数组 数组的创建 var shoppingList: St ...

  8. android-tools-adb

    sudo apt-get install android-tools-adbsudo apt-get install android-tools-fastboot

  9. 使用jQuery开发一个带有密码强度检验的超酷注册页面

    在今天的jQuery教程中,我们将介绍如何使用jQuery和其它相关的插件来生成一个漂亮的带有密码强度检验的注册页面,希望大家喜欢! 相关的插件和类库 complexify - 一个密码强度检验jQu ...

  10. nginx 常用配置说明

    一.location 配置 1.1 语法规则: location [=|~|~*|^~] /uri/ { … }= 开头表示精确匹配^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即可 ...