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. ambari初始化登陆账号/密码假如不是admin/admin

    如题:通常软件初始化密码都是admin: 但是hortonworks就突然傻逼了,居然不这样搞.(可能知道一些开发者不看官网文档,就特意弄成这样.正如我) 我上网搜了5分钟.感觉网上应该没有这样的资料 ...

  2. 原创:goldengate从11.2升级到12.1.2

    goldengate从11.2升级到12.1.2 1.停止抽取进程 GGSCI (001.oracle.drs.dc.com) 286> stop EXTSJ01 2. 停止投递和复制进程 等待 ...

  3. Mac 安装终端软件

    1.安装或者重新安装lua环境 下载 lua 地址: http://www.lua.org/versions.html 1.进入 lua 目录 2.make macosx 3.sudo make in ...

  4. [译] 一、为何要推出AppCoda系列?

    声明:本文翻译自AppCoda网站的文章:Why Launching AppCoda?,作者是创建者Simon Ng.如有异议,请联系博主. 去年九月份,我在App Store上发布了自己第一个iPh ...

  5. 使用 T-SQL 计算当日日期、本周第一天与最后一天

    --当日日期 ); SET @Today = DATENAME(YEAR, GETDATE()) + '-' + DATENAME(MONTH, GETDATE()) + '-' + DATENAME ...

  6. 一个winform带你玩转rabbitMQ

    源码已放出 https://github.com/dubing/MaoyaRabbit 本章分3部分 一.安装部署初探 二.进阶 三.api相关 安装 部署 初探 先上图 一. 安装部署 下载 rab ...

  7. 通过Jni实现AES的CBC模式加密解密

    AES加密方式基本实现,出现一个问题就是代码的安全性.我们知道java层代码很容易被反编译,很有可能泄漏我们加密方式与密钥 内容,那我们该怎么办呢?我们可以使用c/c++实现加密,编译成So库的形式, ...

  8. Ubuntu14.04手动创建桌面快捷方式

    如果是系统自带的程序,默认的桌面图标放在 /usr/share/applications/下面,可以直接将对应的图标放到当前用户的~/Desktop/目录下即可 如果是从网上下载已编译的二进制文件(e ...

  9. win10上安装Docker

    方法1:具体我没有试过,不知道win10下可以么.http://blog.csdn.net/zistxym/article/details/42918339 方法2: 先安装VirtualBox(下载 ...

  10. MyEclipse自动生成hibernate实体类和配置文件攻略

    步骤1:找到导航栏里面的window--showView然后输入db brower,打开数据库浏览窗口步骤2:在数据库浏览窗口里只有一个Myeclipse自带的数据库,该数据没有用,我们在空白的地方右 ...