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. 【linux】文件隐藏属性

        这些隐藏的属性确实对于系统有很大的帮助的- 尤其是在系统安全 (Security) 上面,重要的紧呢!不过要先强调的是,底下的chattr指令只能在Ext2/Ext3的文件系统上面生效, 其他 ...

  2. dubbo通信协议之对比

    对dubbo的协议的学习,可以知道目前主流RPC通信大概是什么情况,本文参考dubbo官方文档 http://dubbo.io/User+Guide-zh.htm dubbo共支持如下几种通信协议: ...

  3. Becoming a Data Scientist – Curriculum via Metromap

    From: http://nirvacana.com/thoughts/becoming-a-data-scientist/ Data Science, Machine Learning, Big D ...

  4. MX5 ADB 链接error: device not found

    这个问题郁闷了好久,因为事情比较忙也没时间解决.每次是开启360 一键 root 勉强调试.今天狠下心把它解决了.解决办法有以下几个步骤: 1.连接方式改成 “内置光盘”,这样手机第一次连接会安装驱动 ...

  5. glide 加载圆角图片

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABEIAAAD3CAIAAACW6Gb7AAAgAElEQVR4nOy9e1QbZf74//zO4XvOYz

  6. android 开发 - 网络图片加载库 Fresco 的使用。

    概述 Fresco 是 facebook 的开源类库,它支持更有效的加载网络图片以及资源图片.它自带三级缓存功能,让图片显示更高效. 介绍 Fresco 是一个强大的图片加载组件. Fresco 中设 ...

  7. 记录一个Word操作技巧,很偏门的,鉴于Google很不方便用了,百度起来比较费劲所以记录一下

    拿到一篇文章需要修改时需要将文中某一段带有特定文字的段落删除,比如一段带有“淘宝网”文字的广告性宣传,且这种段落并不是全都一样,数量也很多,不太可能手动一段一段找到Delete,这就可以用这个替换查找 ...

  8. Android代码截屏

    本文来源:http://myhpu2008.iteye.com/blog/999779 这种方法应该只能对当前Activity本身进行截屏,因而你只能在你应用程序中参照该代码对其应用程序本身截屏. i ...

  9. 优化LibreOffice如此简单

    对于开源软件的支持者和粉丝来说,LibreOffice 无疑是 Microsoft Office 的最佳替代品,而且它已在过去的许多版本迭代中迎来了许多巨大改进.然而,通过用户的手动配置,我们还是有办 ...

  10. codeforces MUH and Important Things

    /* 题意:给一个序列,表示每一项任务的难度,要求完成每一项任务的循序是按照难度由小到大的!输出三种符合要求的工作顺序的序列! 思路:直接看代码.... */ 1 #include<iostre ...