第 N 个泰波那契数
作者:互联网
class Solution {
public int tribonacci(int n) {
if(n==0){
return 0;
}
if(n==1){
return 1;
}
int left =0,right = 1, sum=0;
int []nums = new int [n+1];
nums[0]=0;
nums[1]=1;
nums[2]=1;
for(int i = 3; i <= n; i++){
nums[i]=nums[i-1]+nums[i-2]+nums[i-3];
}
return nums[n];
}
}
标签:契数,right,return,nums,int,sum,个泰波 来源: https://blog.csdn.net/gps666666/article/details/120195024