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 ...
随机推荐
- vscode安装eslint插件,代码统一自动修复
ESlint:是用来统一JavaScript代码风格的工具,不包含css.html等. 方法和步骤: 通常情况下vue项目都会添加eslint组件,我们可以查看webpack的配置文件package. ...
- Cannot use JSX unless the '--jsx' flag is provided.
在tsx文件中加入html代码后,报错 Cannot use JSX unless the '--jsx' flag is provided. 解决方法: 在tsconfig.json中加入: &qu ...
- Genymotion 配置
配置Android的SDK
- zookeeper系列(二)zookeeper的使用--javaAPI
作者:leesf 掌控之中,才会成功:掌控之外,注定失败: 出处:http://www.cnblogs.com/leesf456/ (尊重原创,感谢作者整理的这么好,作者的部分内容添加了我的理解 ...
- springboot拦截异常信息发送邮件提醒
-- private JavaMailSender sender; 可能会出现注入错误,请注意yam配置文件中格式是否一致:否则会找不到注入的bean 一 发送邮件 在Springboot中发送邮件非 ...
- LeetCode 137. 只出现一次的数字 II(Single Number II)
题目描述 给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现了三次.找出那个只出现了一次的元素. 说明: 你的算法应该具有线性时间复杂度. 你可以不使用额外空间来实现吗? 示例 1: ...
- Springboot websocket使用
1)基本概念 1.http与websocket http超文本传输协议,大家都非常熟悉,http有1.0.1.1. 2.0几个版本,从http1.1起,默认都开启了Keep-Alive,保持连接持续性 ...
- laravel 文件上传总结
调用 store 方法会生成唯一的 ID 来作为文件名,如果想获取原件本来的名称可以使用 $file = $request->file('file'); $file->getClientO ...
- koa 基础(三)路由的另一种写法
1.配置路由 app.js // 引入模块 const Koa = require('koa'); const router = require('koa-router')(); /*引入是实例化路由 ...
- 一、基础篇--1.2Java集合-HashMap和ConcurrentHashMap的区别【转】
http://www.importnew.com/28263.html 今天发一篇”水文”,可能很多读者都会表示不理解,不过我想把它作为并发序列文章中不可缺少的一块来介绍.本来以为花不了多少时间的,不 ...