1137. N-th Tribonacci Number(Memory Usage: 13.9 MB, less than 100.00% of Python3)

其实思路很简单,套用一下普通斐波那契数列的非递归做法即可,不过这个成绩我一定要纪念一下,哈哈哈哈哈
代码在这儿:
class Solution:
def tribonacci(self, n: int) -> int:
a, b, c =0, 1, 1
if n is 0:
return 0
if n is 1:
return 1
if n is 2:
return 1
for i in range(2, n):
a, b ,c = b, c, a+b+c
return c
1137. N-th Tribonacci Number(Memory Usage: 13.9 MB, less than 100.00% of Python3)的更多相关文章
- 【Leetcode_easy】1137. N-th Tribonacci Number
problem 1137. N-th Tribonacci Number solution: class Solution { public: int tribonacci(int n) { ) ; ...
- SHELL:Find Memory Usage In Linux (统计每个程序内存使用情况)
转载一个shell统计linux系统中每个程序的内存使用情况,因为内存结构非常复杂,不一定100%精确,此shell可以在Ghub上下载. [root@db231 ~]# ./memstat.sh P ...
- 5 commands to check memory usage on Linux
Memory Usage On linux, there are commands for almost everything, because the gui might not be always ...
- Memory usage of a Java process java Xms Xmx Xmn
http://www.oracle.com/technetwork/java/javase/memleaks-137499.html 3.1 Meaning of OutOfMemoryError O ...
- Redis: Reducing Memory Usage
High Level Tips for Redis Most of Stream-Framework's users start out with Redis and eventually move ...
- Shell script for logging cpu and memory usage of a Linux process
Shell script for logging cpu and memory usage of a Linux process http://www.unix.com/shell-programmi ...
- hadoop的job执行在yarn中内存分配调节————Container [pid=108284,containerID=container_e19_1533108188813_12125_01_000002] is running beyond virtual memory limits. Current usage: 653.1 MB of 2 GB physical memory used
实际遇到的真实问题,解决方法: 1.调整虚拟内存率yarn.nodemanager.vmem-pmem-ratio (这个hadoop默认是2.1) 2.调整map与reduce的在AM中的大小大于y ...
- Why does the memory usage increase when I redeploy a web application?
That is because your web application has a memory leak. A common issue are "PermGen" memor ...
- Kafka:ZK+Kafka+Spark Streaming集群环境搭建(十三)kafka+spark streaming打包好的程序提交时提示虚拟内存不足(Container is running beyond virtual memory limits. Current usage: 119.5 MB of 1 GB physical memory used; 2.2 GB of 2.1 G)
异常问题:Container is running beyond virtual memory limits. Current usage: 119.5 MB of 1 GB physical mem ...
随机推荐
- Spring Boot 中初始化资源的几种方式(转)
假设有这么一个需求,要求在项目启动过程中,完成线程池的初始化,加密证书加载等功能,你会怎么做?如果没想好答案,请接着往下看.今天介绍几种在Spring Boot中进行资源初始化的方式,帮助大家解决和回 ...
- 【SQL Server】使用SQL比较版本号
最近遇到这么一个场景,需要用SQL从表里取出版本号小于'10.2'的所有数据.目前表中以存在的数据中,版本号有两种格式,一个是'X.Y',另一个是'X'.对于SQL Server来说,其没有strin ...
- Confluence 6.15 博客页面(Blog Posts)宏
博客页面宏允许你 Confluence 页面中显示博客页面.通过单击博客的标题将会把你链接到博客页面中. 使用博客页面宏 为了将博客页面宏添加到页面中: 从编辑工具栏中,选择 插入(Insert) ...
- 51 Nod 1282 时钟 (循环中的最小表示+哈希)
1282 时钟 题目来源: Codility 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注 有N个时钟,每个时钟有M个指针,P个刻度.时钟是圆形 ...
- HAOI2010软件安装
首先tarjan缩点应该能看出来,然后我用topsort跑了个DAG上的一维dp,结果WA的很惨. 其实用DAG应该也能做,但是DAG强调整体顺序,而对一些局部问题,例如两个儿子怎么分配,是否给当前节 ...
- 2018-2019-2 20175215 实验三《敏捷开发与XP实践》实验报告
一.实验内容与步骤 1.安装.使用alibaba 插件规范代码 在IDEA的setting中找到plugins并搜索alibaba,点击install进行安装 重启IDEA后,在代码中右击点击编码规约 ...
- php phpexcel 创建excel
public function createExcel($result=[],$fileName=''){ \think\Loader::import('extend.excel.PHPExcel', ...
- go get命令在go mod目录下与正常目录执行的区别
转载自https://www.jianshu.com/p/0a2ebb07da54 非$GOPATH目录下的go mod项目 $ go mod init test $ cat go.mod modul ...
- GitHub-Microsoft:DotNet2
ylbtech-GitHub-Microsoft:DotNet2 1.返回顶部 · SignService Code Signing service and Client for Authentico ...
- 阶段3 3.SpringMVC·_07.SSM整合案例_08.ssm整合之Spring整合MyBatis框架
service能供成功的调用到service对象就算是整合成功 如果能把生成的代理对象也存大IOC的容器中.那么ServiceImpl就可以拿到这个对象 做一个注入,然后就可以调用代理对象的查询数据库 ...