其实思路很简单,套用一下普通斐波那契数列的非递归做法即可,不过这个成绩我一定要纪念一下,哈哈哈哈哈

代码在这儿:

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)的更多相关文章

  1. 【Leetcode_easy】1137. N-th Tribonacci Number

    problem 1137. N-th Tribonacci Number solution: class Solution { public: int tribonacci(int n) { ) ; ...

  2. SHELL:Find Memory Usage In Linux (统计每个程序内存使用情况)

    转载一个shell统计linux系统中每个程序的内存使用情况,因为内存结构非常复杂,不一定100%精确,此shell可以在Ghub上下载. [root@db231 ~]# ./memstat.sh P ...

  3. 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 ...

  4. 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 ...

  5. Redis: Reducing Memory Usage

    High Level Tips for Redis Most of Stream-Framework's users start out with Redis and eventually move ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. Redis介绍、安装、配置

    NoSQL介绍 NoSQL(NoSQL=Not Only SQL),意为反SQL运动,是一项全新的数据库革命性运动.指的是非关系型数据库,解决了传统的关系型数据库,难以解决的超大规模和高并发的的问题 ...

  2. Java-五种线程池,四种拒绝策略,三种阻塞队列(转)

    Java-五种线程池,四种拒绝策略,三种阻塞队列 三种阻塞队列:    BlockingQueue<Runnable> workQueue = null;    workQueue = n ...

  3. asp.net大文件传输断点续传源码

    HTML部分 <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="index.aspx. ...

  4. BFS解决九宫重排问题

    问题 1426: [蓝桥杯][历届试题]九宫重排 时间限制: 1Sec 内存限制: 128MB 提交: 215 解决: 47 题目描述 如下面第一个图的九宫格中,放着  1~8  的数字卡片,还有一个 ...

  5. 服务不支持 chkconfig 的解决办法

    在chkconfig --add servername的时候老是提示服务不支持 chkconfig 经过查找,解决办法如下. 1.脚本tomcatstart前三行如下: #!/bin/bash #ch ...

  6. TCP窗口扩大选项Window Scale

    窗口扩大选项使TCP的窗口定义从16bit增加到32bit.这并不是通过修改TCP首部来实现的,TCP首部仍然使用16bit,而是通过定义一个选项实现对16bit的扩大操作来完成的.于是TCP在内部将 ...

  7. vxWorks下常用的几种延时方法

         在应用编程的时候,通常会碰到需要一个任务在特定的延时之后执行一个指定的动作,如等待外设以确保数据可靠,控制扬声器发声时间以及串口通信超时重发等.这就需要利用定时器机制来计量特定长度的时间段. ...

  8. vue路由在keep-alive下的刷新问题 对watch的影响

    转载自:https://www.cnblogs.com/dansingal/p/8302100.html 问题描述: 在keep-alive中的在跳转到指定的路由时刷新对应的路由,其余不刷新. 1 2 ...

  9. python - linux下 no module named pip

    有网络的情况下,linux系统提示无法使用pip命令: 有两种解决方式: 第一种: =============================== 敲命令:python -m ensurepip 得到 ...

  10. mysql知识点汇集

    1.将两个表字段类型一致的数据合并到一个新表的命令. INSERT into new_table(user_name,password,age) SELECT user_name,password,a ...